From 525e734832f171f6087e99fc0207286a57c45894 Mon Sep 17 00:00:00 2001 From: Donien <88634789+Donien@users.noreply.github.com> Date: Thu, 10 Oct 2024 10:09:04 +0200 Subject: [PATCH 1/2] Move package variables to defaults [Icinga 2] --- roles/icinga2/defaults/main.yml | 1 + roles/icinga2/tasks/install_on_Debian.yml | 2 +- roles/icinga2/tasks/install_on_RedHat.yml | 4 ++-- roles/icinga2/tasks/install_on_Suse.yml | 2 +- roles/icinga2/vars/Debian.yml | 2 +- roles/icinga2/vars/RedHat.yml | 2 +- roles/icinga2/vars/Suse-12.yml | 2 +- roles/icinga2/vars/Suse.yml | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/roles/icinga2/defaults/main.yml b/roles/icinga2/defaults/main.yml index af57d1cb..20d499b2 100644 --- a/roles/icinga2/defaults/main.yml +++ b/roles/icinga2/defaults/main.yml @@ -1,4 +1,5 @@ --- +icinga2_packages: ["icinga2"] icinga2_state: started icinga2_enabled: true icinga2_confd: true diff --git a/roles/icinga2/tasks/install_on_Debian.yml b/roles/icinga2/tasks/install_on_Debian.yml index 7594b554..f787d3e9 100644 --- a/roles/icinga2/tasks/install_on_Debian.yml +++ b/roles/icinga2/tasks/install_on_Debian.yml @@ -1,5 +1,5 @@ --- - name: Apt - install package icinga2 ansible.builtin.apt: - pkg: "{{ icinga2_packages }}" + pkg: "{{ icinga2_packages + icinga2_packages_dependencies }}" state: present diff --git a/roles/icinga2/tasks/install_on_RedHat.yml b/roles/icinga2/tasks/install_on_RedHat.yml index 56313f0c..42447ecf 100644 --- a/roles/icinga2/tasks/install_on_RedHat.yml +++ b/roles/icinga2/tasks/install_on_RedHat.yml @@ -1,8 +1,8 @@ - name: Yum - install package icinga2 ansible.builtin.yum: - name: "{{ icinga2_packages }}" + name: "{{ icinga2_packages + icinga2_packages_dependencies }}" state: present - + - name: Yum - install package icinga2-selinux ansible.builtin.yum: name: icinga2-selinux diff --git a/roles/icinga2/tasks/install_on_Suse.yml b/roles/icinga2/tasks/install_on_Suse.yml index 9b7fb34b..650a9735 100644 --- a/roles/icinga2/tasks/install_on_Suse.yml +++ b/roles/icinga2/tasks/install_on_Suse.yml @@ -1,7 +1,7 @@ --- - name: Zypper - install package icinga2 community.general.zypper: - name: "{{ icinga2_packages }}" + name: "{{ icinga2_packages + icinga2_packages_dependencies }}" state: present - name: Zypper - install package icinga2-selinux diff --git a/roles/icinga2/vars/Debian.yml b/roles/icinga2/vars/Debian.yml index f4e03517..2ef068e8 100644 --- a/roles/icinga2/vars/Debian.yml +++ b/roles/icinga2/vars/Debian.yml @@ -1,5 +1,5 @@ --- -icinga2_packages: ["icinga2"] +icinga2_packages_dependencies: [] icinga2_user: nagios icinga2_group: nagios icinga2_config_path: /etc/icinga2 diff --git a/roles/icinga2/vars/RedHat.yml b/roles/icinga2/vars/RedHat.yml index d3844917..12e66d49 100644 --- a/roles/icinga2/vars/RedHat.yml +++ b/roles/icinga2/vars/RedHat.yml @@ -1,5 +1,5 @@ --- -icinga2_packages: ["icinga2"] +icinga2_packages_dependencies: [] icinga2_user: icinga icinga2_group: icinga icinga2_config_path: /etc/icinga2 diff --git a/roles/icinga2/vars/Suse-12.yml b/roles/icinga2/vars/Suse-12.yml index 65a5aed1..7d4206ed 100644 --- a/roles/icinga2/vars/Suse-12.yml +++ b/roles/icinga2/vars/Suse-12.yml @@ -1,5 +1,5 @@ --- -icinga2_packages: ["icinga2","libboost_regex1_54_0"] +icinga2_packages_dependencies: ["libboost_regex1_54_0"] icinga2_user: icinga icinga2_group: icinga icinga2_config_path: /etc/icinga2 diff --git a/roles/icinga2/vars/Suse.yml b/roles/icinga2/vars/Suse.yml index cfdff9ee..798c6b96 100644 --- a/roles/icinga2/vars/Suse.yml +++ b/roles/icinga2/vars/Suse.yml @@ -1,5 +1,5 @@ --- -icinga2_packages: ["icinga2","libboost_regex1_66_0"] +icinga2_packages_dependencies: ["libboost_regex1_66_0"] icinga2_user: icinga icinga2_group: icinga icinga2_config_path: /etc/icinga2 From 5cab00590722f2f96374faf3eb826829d3698997 Mon Sep 17 00:00:00 2001 From: Donien <88634789+Donien@users.noreply.github.com> Date: Thu, 10 Oct 2024 10:23:41 +0200 Subject: [PATCH 2/2] Move packages variables to defaults [Icinga Web 2] --- roles/icingaweb2/README.md | 3 +++ roles/icingaweb2/defaults/main.yml | 1 + roles/icingaweb2/tasks/install_on_debian.yml | 2 +- roles/icingaweb2/tasks/install_on_redhat.yml | 2 +- roles/icingaweb2/tasks/install_on_suse.yml | 2 +- roles/icingaweb2/vars/debian-ubuntu.yml | 2 +- roles/icingaweb2/vars/debian.yml | 2 +- roles/icingaweb2/vars/redhat.yml | 2 +- roles/icingaweb2/vars/suse.yml | 2 +- 9 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 roles/icingaweb2/README.md diff --git a/roles/icingaweb2/README.md b/roles/icingaweb2/README.md new file mode 100644 index 00000000..7fc3379d --- /dev/null +++ b/roles/icingaweb2/README.md @@ -0,0 +1,3 @@ +### Workaround Missing README + +Issue: https://github.com/ansible/galaxy/issues/2438 diff --git a/roles/icingaweb2/defaults/main.yml b/roles/icingaweb2/defaults/main.yml index b0034f14..3e9d913e 100644 --- a/roles/icingaweb2/defaults/main.yml +++ b/roles/icingaweb2/defaults/main.yml @@ -1,3 +1,4 @@ +icingaweb2_packages: ["icingaweb2", "icingacli"] icingaweb2_config_dir: /etc/icingaweb2 icingaweb2_group: icingaweb2 icingaweb2_modules_config_dir: "{{ icingaweb2_config_dir }}/modules" diff --git a/roles/icingaweb2/tasks/install_on_debian.yml b/roles/icingaweb2/tasks/install_on_debian.yml index 621078ca..7b500e9a 100644 --- a/roles/icingaweb2/tasks/install_on_debian.yml +++ b/roles/icingaweb2/tasks/install_on_debian.yml @@ -1,6 +1,6 @@ --- - name: Debian - Install Icinga Web 2 packages ansible.builtin.apt: - name: "{{ icingaweb2_packages }}" + name: "{{ icingaweb2_packages + icingaweb2_packages_dependencies }}" state: present update_cache: True diff --git a/roles/icingaweb2/tasks/install_on_redhat.yml b/roles/icingaweb2/tasks/install_on_redhat.yml index cd706311..e0ca4eda 100644 --- a/roles/icingaweb2/tasks/install_on_redhat.yml +++ b/roles/icingaweb2/tasks/install_on_redhat.yml @@ -1,5 +1,5 @@ --- - name: RedHat - Install Icinga Web 2 packages ansible.builtin.yum: - name: "{{ icingaweb2_packages }}" + name: "{{ icingaweb2_packages + icingaweb2_packages_dependencies }}" state: present diff --git a/roles/icingaweb2/tasks/install_on_suse.yml b/roles/icingaweb2/tasks/install_on_suse.yml index b8588c5b..4d110226 100644 --- a/roles/icingaweb2/tasks/install_on_suse.yml +++ b/roles/icingaweb2/tasks/install_on_suse.yml @@ -1,5 +1,5 @@ --- - name: Suse - Install Icinga Web 2 packages community.general.zypper: - name: "{{ icingaweb2_packages }}" + name: "{{ icingaweb2_packages + icingaweb2_packages_dependencies }}" state: present diff --git a/roles/icingaweb2/vars/debian-ubuntu.yml b/roles/icingaweb2/vars/debian-ubuntu.yml index 10b89b9c..61e286d9 100644 --- a/roles/icingaweb2/vars/debian-ubuntu.yml +++ b/roles/icingaweb2/vars/debian-ubuntu.yml @@ -1,3 +1,3 @@ icingaweb2_httpd_user: www-data icingaweb2_fragments_path: /var/tmp/icingaweb -icingaweb2_packages: ["icingaweb2","icingacli","libapache2-mod-php"] +icingaweb2_packages_dependencies: ["libapache2-mod-php"] diff --git a/roles/icingaweb2/vars/debian.yml b/roles/icingaweb2/vars/debian.yml index 081fe9e9..6c08db22 100644 --- a/roles/icingaweb2/vars/debian.yml +++ b/roles/icingaweb2/vars/debian.yml @@ -1,3 +1,3 @@ icingaweb2_httpd_user: www-data icingaweb2_fragments_path: /var/tmp/icingaweb -icingaweb2_packages: ["icingaweb2", "icingacli"] +icingaweb2_packages_dependencies: [] diff --git a/roles/icingaweb2/vars/redhat.yml b/roles/icingaweb2/vars/redhat.yml index 38ea1bbd..e13f0c5f 100644 --- a/roles/icingaweb2/vars/redhat.yml +++ b/roles/icingaweb2/vars/redhat.yml @@ -1,4 +1,4 @@ --- icingaweb2_httpd_user: apache icingaweb2_fragments_path: /var/tmp/icingaweb -icingaweb2_packages: ["icingaweb2", "icingacli", "icingaweb2-selinux"] +icingaweb2_packages_dependencies: ["icingaweb2-selinux"] diff --git a/roles/icingaweb2/vars/suse.yml b/roles/icingaweb2/vars/suse.yml index ed99ea69..d4ee5f47 100644 --- a/roles/icingaweb2/vars/suse.yml +++ b/roles/icingaweb2/vars/suse.yml @@ -1,4 +1,4 @@ --- icingaweb2_httpd_user: wwwrun icingaweb2_fragments_path: /var/tmp/icingaweb -icingaweb2_packages: ["icingaweb2", "icingacli"] +icingaweb2_packages_dependencies: []