First attempt to convey package addition/removal from configuration.

This commit is contained in:
Emiliano Vavassori 2015-09-07 21:26:08 +02:00
parent ce71b22055
commit 09bdc182ea
4 changed files with 19 additions and 2 deletions

View File

@ -1,3 +1,3 @@
[defaults]
inventory=hosts
inventory=ansdyninv.py
log_path=/var/log/ansible.log

1
hosts
View File

@ -1 +0,0 @@
localhost ansible_connection=local

View File

@ -7,3 +7,8 @@
tags:
- base
- edubuntu
- include: role.yml
tags:
- base
- role

13
roles/base/tasks/role.yml Normal file
View File

@ -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 }}"