fin mon premeier playbook

This commit is contained in:
2025-01-24 09:51:16 +01:00
parent 8943b7df14
commit a06ebd69ea

32
premier_playbook Normal file
View File

@@ -0,0 +1,32 @@
- name: premier playbook
hosts: master
become: true
tasks:
- name: authorisation ssh user ansible
lineinfile:
dest: /etc/ssh/sshd_config
state: present
regexp: '^#Match User anoncvs'
line: 'Match User ansible'
- name: authorisation source ssh user ansible
blockinfile:
path: /etc/ssh/sshd_config
marker: "#<!-- {mark} ANSIBLE MANAGED BLOCK -->"
insertafter: '^Match User ansible'
block: |
AllowUsers ansible@192.168.14.1
PasswordAuthentication no
- name: redémarrage service sshd
service:
name: ssh
state: restarted
- name: installer le service bind
apt:
update_cache: yes
name: bind9
state: present
- name: verrouillage logon user ansible
user:
user: ansible
password_lock: true