Files
playbookansible/premier_playbook
2025-01-24 09:51:16 +01:00

33 lines
899 B
Plaintext

- 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