2015-07-07 21:41:59 +00:00
|
|
|
---
|
|
|
|
# Task di configurazione iniziali
|
|
|
|
|
|
|
|
- name: Creazione utente di gestione
|
|
|
|
user:
|
|
|
|
name: amgmt
|
|
|
|
comment: "Ansible Management User"
|
|
|
|
group: users
|
|
|
|
password: $6$rounds=100000$XvHuMoXtpCksx379$nhlfUn38.oBB7JrDrtwfUisw8T0Bg5InzFq1fw31mcEmGZ2AYFkFK2zC2g04lSfw.kpdSgqH3Dl5q9r1fY6.k.
|
|
|
|
shell: /bin/bash
|
|
|
|
state: present
|
|
|
|
generate_ssh_key: yes
|
|
|
|
|
|
|
|
- name: Concessione diritti sudo all'utente ansible
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/sudoers.d/amgmt
|
|
|
|
regexp: "^amgmt.*NOPASSWD"
|
|
|
|
line: "amgmt ALL=(ALL:ALL) NOPASSWD:ALL"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0440
|
|
|
|
create: yes
|
|
|
|
state: present
|
2015-07-08 08:28:20 +00:00
|
|
|
validate: "visudo -c -f '%s'"
|
2015-07-07 21:41:59 +00:00
|
|
|
|
2015-07-08 00:16:16 +00:00
|
|
|
- name: Autorizzazione della chiave pubblica del server
|
|
|
|
authorized_key:
|
|
|
|
user: amgmt
|
|
|
|
key: "{{ lookup('pipe', 'curl -sSL http://' + serverfqdn + ':3001/mgmtkey') }}"
|
|
|
|
state: present
|