From 96132ae60a51cb915e879fe1cdab3b12e6fa4ec3 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Mon, 31 Jul 2023 15:27:56 +0200 Subject: [PATCH] enhancement(ansible/host.yml) remove packages --- ansible/host.yml | 8 +++++++- ansible/host_modified.yml | 1 + ansible/inventory.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ansible/host.yml b/ansible/host.yml index 8cb3a6a..0a50c0a 100644 --- a/ansible/host.yml +++ b/ansible/host.yml @@ -10,12 +10,18 @@ ansible.builtin.hostname: name: "{{ inventory_hostname }}" -- name: "Packages installation" +- name: "Install packages" apt: pkg: "{{ vars[inventory_hostname]['general']['host_packages'] }}" update_cache: yes state: latest +- name: "Remove packages" + apt: + pkg: "{{ vars[inventory_hostname]['general']['host_removed_packages'] }}" + update_cache: yes + state: absent + - name: "Add keyrings directory" file: path: /etc/apt/keyrings diff --git a/ansible/host_modified.yml b/ansible/host_modified.yml index 21b8f84..328298c 100644 --- a/ansible/host_modified.yml +++ b/ansible/host_modified.yml @@ -57,6 +57,7 @@ - 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'] + ignore_errors: true ansible.builtin.service: name: "{{ item.value['doc'] }}" state: started diff --git a/ansible/inventory.py b/ansible/inventory.py index 8549309..43ee976 100755 --- a/ansible/inventory.py +++ b/ansible/inventory.py @@ -76,7 +76,7 @@ class RisottoInventory(object): 'hosts': servers, 'vars': { # FIXME - 'ansible_ssh_host': '192.168.0.29', +# 'ansible_ssh_host': '192.168.0.28', 'ansible_ssh_user': 'root', 'ansible_python_interpreter': '/usr/bin/python3' }