From 1651cb1ef8eaf1674b7e7c4f3ccb173132aca94a Mon Sep 17 00:00:00 2001 From: Simone Visconti <simone.visconti@reti.it> Date: Mon, 4 Feb 2019 16:36:59 +0100 Subject: [PATCH] updated playbook and tasks --- ansible-intro/{test4 => test3}/ansible.cfg | 0 ansible-intro/test3/generic/tasks/main.yml | 26 +++++-------------- .../{test4 => test3}/generic/vars/main.yml | 0 ansible-intro/test3/inventory/inventory.test | 2 -- ansible-intro/test3/playbook.retry | 2 -- ansible-intro/test3/playbook.yml | 12 ++++----- ansible-intro/test4/generic/tasks/main.yml | 23 +++++++++++----- .../generic/templates/sshd_config.j2 | 0 ansible-intro/test4/playbook.yml | 6 ++--- 9 files changed, 32 insertions(+), 39 deletions(-) rename ansible-intro/{test4 => test3}/ansible.cfg (100%) rename ansible-intro/{test4 => test3}/generic/vars/main.yml (100%) delete mode 100644 ansible-intro/test3/playbook.retry rename ansible-intro/{test3 => test4}/generic/templates/sshd_config.j2 (100%) diff --git a/ansible-intro/test4/ansible.cfg b/ansible-intro/test3/ansible.cfg similarity index 100% rename from ansible-intro/test4/ansible.cfg rename to ansible-intro/test3/ansible.cfg diff --git a/ansible-intro/test3/generic/tasks/main.yml b/ansible-intro/test3/generic/tasks/main.yml index 421c8af..30040ed 100644 --- a/ansible-intro/test3/generic/tasks/main.yml +++ b/ansible-intro/test3/generic/tasks/main.yml @@ -1,22 +1,8 @@ --- +- name: + become_method: + apt: - - -- name: creo l'utente - become_method: sudo - user: - name: visconti - home: /home/visconti - -- name: aggiungo la chiave ssh - become_method: sudo - authorized_key: - user: visconti - key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTjto9+ehFHHvxkxF916JoPhVp1WqilnS8+pxKgmKtub0t8bcYbQNoRaAXax5AxPAsRxClqSqmgYS98D3VXvJJtfv9hmWiPQRjKOeehz7SP0v1Cstd7G5dBcJF2pSPqXUKTepwrIvCJ4sjfCydc+RJpjbi00lkwefFr2Zk0fYnIRcE1UF/iNT0sNHBT3eIY9WQqwiPjakF9jlkWr0kORHLj+K+9n9h2eqprrWXxlpM/daA1oXyxBTAZbVtRIaYBsxSKDAEZyLgQ3kM56W9OZVOo3aDKliUP+AvdKrWKMj1ZryNNZHg5/MnkXXlOQZ5Qk1nj9C2yCVtLjmFz0L01pr9 root@visconti" - -- name: Cambio sshd_config - become_user: root - template: - src: generic/templates/sshd_config.j2 - dest: /etc/ssh/sshd_config - +- name: + become_method: + pip: diff --git a/ansible-intro/test4/generic/vars/main.yml b/ansible-intro/test3/generic/vars/main.yml similarity index 100% rename from ansible-intro/test4/generic/vars/main.yml rename to ansible-intro/test3/generic/vars/main.yml diff --git a/ansible-intro/test3/inventory/inventory.test b/ansible-intro/test3/inventory/inventory.test index 382ae5e..e69de29 100644 --- a/ansible-intro/test3/inventory/inventory.test +++ b/ansible-intro/test3/inventory/inventory.test @@ -1,2 +0,0 @@ -192.168.11.17 -192.168.11.75 diff --git a/ansible-intro/test3/playbook.retry b/ansible-intro/test3/playbook.retry deleted file mode 100644 index 382ae5e..0000000 --- a/ansible-intro/test3/playbook.retry +++ /dev/null @@ -1,2 +0,0 @@ -192.168.11.17 -192.168.11.75 diff --git a/ansible-intro/test3/playbook.yml b/ansible-intro/test3/playbook.yml index 0b6dd18..4b2f6be 100644 --- a/ansible-intro/test3/playbook.yml +++ b/ansible-intro/test3/playbook.yml @@ -1,8 +1,8 @@ -#Test 3: Creare un utente personale -- name: creo l'utente visconti - hosts: all - become: yes - remote_user: ubuntu +#Test ripetere l'esercizio 2, ma eseguire l'installazione dei pacchetti pip soltanto su una VM +- name: + hosts: + become: + remote_user: roles: - - generic + - diff --git a/ansible-intro/test4/generic/tasks/main.yml b/ansible-intro/test4/generic/tasks/main.yml index 30040ed..3c359c4 100644 --- a/ansible-intro/test4/generic/tasks/main.yml +++ b/ansible-intro/test4/generic/tasks/main.yml @@ -1,8 +1,19 @@ --- -- name: - become_method: - apt: +- name: creo l'utente + become_method: sudo + user: + name: + home: + +- name: aggiungo la chiave ssh + become_method: sudo + authorized_key: + user: + key: + +- name: Cambio sshd_config + become_user: root + template: + src: + dest: -- name: - become_method: - pip: diff --git a/ansible-intro/test3/generic/templates/sshd_config.j2 b/ansible-intro/test4/generic/templates/sshd_config.j2 similarity index 100% rename from ansible-intro/test3/generic/templates/sshd_config.j2 rename to ansible-intro/test4/generic/templates/sshd_config.j2 diff --git a/ansible-intro/test4/playbook.yml b/ansible-intro/test4/playbook.yml index c4d9cfd..46d5637 100644 --- a/ansible-intro/test4/playbook.yml +++ b/ansible-intro/test4/playbook.yml @@ -1,8 +1,8 @@ -#Test ripetere l'esercizio 2, ma eseguire l'installazione dei pacchetti pip soltanto su una VM -- name: +#Test 3: Creare un utente personale +- name: creo l'utente visconti hosts: become: remote_user: roles: - - + - generic -- GitLab