2
0

add Exercice convert adhoc to playbook

This commit is contained in:
2020-05-05 23:13:22 +02:00
parent 2031ed98ac
commit d6f6ecb393
2 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
---
- name: setup target to be managed by ansible
hosts: cibles
become: true
tasks:
- name: create account
user:
name: ansible
password: "{{ '123Soleil' | password_has('sha512') }}"
create_home: yes
home: /home/ansible
- name: configure sudo
copy:
content: "ansible ALL=(ALL) NOPASSWD: ALL"
dest: /etc/sudoers.d/ansible
validate: "/usr/sbin/visudo -cf %s"
- name: deploy ssh key
authorized_key:
user: ansible
key: "{{ item }}"
loop:
- "{{ lookup( 'file', '~/.ssh/id_rsa.pub' ) }}"
- "https://infra.opendoor.fr/id_rsa.pub"