enhancement(ansible/host.yml) remove packages

This commit is contained in:
egarette@silique.fr 2023-07-31 15:27:56 +02:00
parent db86a3d02c
commit 96132ae60a
3 changed files with 9 additions and 2 deletions

View file

@ -10,12 +10,18 @@
ansible.builtin.hostname: ansible.builtin.hostname:
name: "{{ inventory_hostname }}" name: "{{ inventory_hostname }}"
- name: "Packages installation" - name: "Install packages"
apt: apt:
pkg: "{{ vars[inventory_hostname]['general']['host_packages'] }}" pkg: "{{ vars[inventory_hostname]['general']['host_packages'] }}"
update_cache: yes update_cache: yes
state: latest state: latest
- name: "Remove packages"
apt:
pkg: "{{ vars[inventory_hostname]['general']['host_removed_packages'] }}"
update_cache: yes
state: absent
- name: "Add keyrings directory" - name: "Add keyrings directory"
file: file:
path: /etc/apt/keyrings path: /etc/apt/keyrings

View file

@ -57,6 +57,7 @@
- name: "Start services" - name: "Start services"
when: item.value['manage'] and item.value['activate'] and item.value['doc'].endswith('.service') and not item.value['doc'].endswith('@.service') and item.value['engine'] when: item.value['manage'] and item.value['activate'] and item.value['doc'].endswith('.service') and not item.value['doc'].endswith('@.service') and item.value['engine']
ignore_errors: true
ansible.builtin.service: ansible.builtin.service:
name: "{{ item.value['doc'] }}" name: "{{ item.value['doc'] }}"
state: started state: started

View file

@ -76,7 +76,7 @@ class RisottoInventory(object):
'hosts': servers, 'hosts': servers,
'vars': { 'vars': {
# FIXME # FIXME
'ansible_ssh_host': '192.168.0.29', # 'ansible_ssh_host': '192.168.0.28',
'ansible_ssh_user': 'root', 'ansible_ssh_user': 'root',
'ansible_python_interpreter': '/usr/bin/python3' 'ansible_python_interpreter': '/usr/bin/python3'
} }