From 09bdc182eaa4b650fc0c3eba5d3f5f22971250e6 Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Mon, 7 Sep 2015 21:26:08 +0200 Subject: [PATCH] First attempt to convey package addition/removal from configuration. --- ansible.cfg | 2 +- hosts | 1 - roles/base/tasks/main.yml | 5 +++++ roles/base/tasks/role.yml | 13 +++++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) delete mode 100644 hosts create mode 100644 roles/base/tasks/role.yml diff --git a/ansible.cfg b/ansible.cfg index 62ad5f9..083938c 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,3 +1,3 @@ [defaults] -inventory=hosts +inventory=ansdyninv.py log_path=/var/log/ansible.log diff --git a/hosts b/hosts deleted file mode 100644 index 2302eda..0000000 --- a/hosts +++ /dev/null @@ -1 +0,0 @@ -localhost ansible_connection=local diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index dbe6731..f5c4914 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -7,3 +7,8 @@ tags: - base - edubuntu + +- include: role.yml + tags: + - base + - role diff --git a/roles/base/tasks/role.yml b/roles/base/tasks/role.yml new file mode 100644 index 0000000..7ce2de9 --- /dev/null +++ b/roles/base/tasks/role.yml @@ -0,0 +1,13 @@ +--- +# Role based package installation +- name: Installazione pacchetti da aggiungere per il ruolo + apt: name={{ item }} state=present + sudo: yes + when: "{{ addpkg }}|length > 0" + with_items: "{{ addpkg }}" + +- name: Rimozione pacchetti da rimuovere per il ruolo + apt: name={{ item }} state=absent purge=yes + sudo: yes + when: "{{ delpkg }}|length > 0" + with_items: "{{ delpkg }}"