From 15013a665d3b6bbaba4c9f5c93fbd32eb40c57f5 Mon Sep 17 00:00:00 2001 From: "Troy W." Date: Wed, 5 Jun 2024 20:59:43 -0400 Subject: [PATCH] Cleaned up --- .github/workflows/{manage-repo.yml => repo.yml} | 12 ++++++------ changelogs/fragments/pr_1250.yml | 1 + docs/ZABBIX_AGENT_ROLE.md | 1 + docs/ZABBIX_JAVAGATEWAY_ROLE.md | 1 + docs/ZABBIX_PROXY_ROLE.md | 1 + ...ABBIX_MANAGE_REPO_ROLE.md => ZABBIX_REPO_ROLE.md} | 2 +- docs/ZABBIX_SERVER_ROLE.md | 8 ++------ docs/ZABBIX_WEB_ROLE.md | 8 ++------ molecule/zabbix_manage_repo/converge.yml | 2 +- roles/zabbix_agent/tasks/main.yml | 3 ++- roles/zabbix_javagateway/tasks/main.yml | 3 ++- roles/zabbix_manage_repo/README.md | 1 - roles/zabbix_proxy/tasks/Debian.yml | 7 ------- roles/zabbix_proxy/tasks/RedHat.yml | 7 ------- roles/zabbix_proxy/tasks/main.yml | 10 +++++++--- roles/zabbix_repo/README.md | 1 + .../defaults/main.yml | 0 .../handlers/main.yml | 0 .../meta/main.yml | 0 .../tasks/Debian.yml | 0 .../tasks/RedHat.yml | 0 .../tasks/main.yml | 0 .../vars/Debian.yml | 0 .../vars/RedHat.yml | 0 .../vars/main.yml | 0 roles/zabbix_server/tasks/Debian.yml | 1 - roles/zabbix_server/tasks/RedHat.yml | 6 ------ roles/zabbix_server/tasks/main.yml | 9 ++++++++- roles/zabbix_web/tasks/main.yml | 3 ++- 29 files changed, 38 insertions(+), 49 deletions(-) rename .github/workflows/{manage-repo.yml => repo.yml} (90%) rename docs/{ZABBIX_MANAGE_REPO_ROLE.md => ZABBIX_REPO_ROLE.md} (98%) delete mode 120000 roles/zabbix_manage_repo/README.md delete mode 100644 roles/zabbix_proxy/tasks/Debian.yml delete mode 100644 roles/zabbix_proxy/tasks/RedHat.yml create mode 120000 roles/zabbix_repo/README.md rename roles/{zabbix_manage_repo => zabbix_repo}/defaults/main.yml (100%) rename roles/{zabbix_manage_repo => zabbix_repo}/handlers/main.yml (100%) rename roles/{zabbix_manage_repo => zabbix_repo}/meta/main.yml (100%) rename roles/{zabbix_manage_repo => zabbix_repo}/tasks/Debian.yml (100%) rename roles/{zabbix_manage_repo => zabbix_repo}/tasks/RedHat.yml (100%) rename roles/{zabbix_manage_repo => zabbix_repo}/tasks/main.yml (100%) rename roles/{zabbix_manage_repo => zabbix_repo}/vars/Debian.yml (100%) rename roles/{zabbix_manage_repo => zabbix_repo}/vars/RedHat.yml (100%) rename roles/{zabbix_manage_repo => zabbix_repo}/vars/main.yml (100%) delete mode 100644 roles/zabbix_server/tasks/Debian.yml delete mode 100644 roles/zabbix_server/tasks/RedHat.yml diff --git a/.github/workflows/manage-repo.yml b/.github/workflows/repo.yml similarity index 90% rename from .github/workflows/manage-repo.yml rename to .github/workflows/repo.yml index da5ba687d..e124a6e60 100644 --- a/.github/workflows/manage-repo.yml +++ b/.github/workflows/repo.yml @@ -1,16 +1,16 @@ --- -name: "community.zabbix.zabbix_manage_repo" +name: "community.zabbix.zabbix_repo" on: push: paths: - - "roles/zabbix_manage_repo/**" - - "molecule/zabbix_manage_repo/**" + - "roles/zabbix_repo/**" + - "molecule/zabbix_repo/**" - "molecule/requirements.txt" - ".github/workflows/server.yml" pull_request: paths: - - "roles/zabbix_manage_repo/**" - - "molecule/zabbix_manage_repo/**" + - "roles/zabbix_repo/**" + - "molecule/zabbix_repo/**" - "molecule/requirements.txt" - ".github/workflows/server.yml" jobs: @@ -28,7 +28,7 @@ jobs: - debian12 - debian11 collection_role: - - zabbix_manage_repo + - zabbix_repo version: - v64 - v60 diff --git a/changelogs/fragments/pr_1250.yml b/changelogs/fragments/pr_1250.yml index fc89fa860..f1aad8cc9 100644 --- a/changelogs/fragments/pr_1250.yml +++ b/changelogs/fragments/pr_1250.yml @@ -3,3 +3,4 @@ major_changes: minor_changes: - All Roles - Include installation of GPG key for RHEL based operating systems. - All Roles - Add support for yum authentication on RHEL based operating systems. + - All Roles - Add the `zabbix_manage_repo` variable. diff --git a/docs/ZABBIX_AGENT_ROLE.md b/docs/ZABBIX_AGENT_ROLE.md index dcc7ed6ff..76a1c3239 100644 --- a/docs/ZABBIX_AGENT_ROLE.md +++ b/docs/ZABBIX_AGENT_ROLE.md @@ -119,6 +119,7 @@ The following is an overview of all available configuration default for this rol * `zabbix_repo_deb_component`: The repository component for Debian installs. Default `main`. * `zabbix_repo_deb_gpg_key_url`: The URL to download the Zabbix GPG key from. Default `http://repo.zabbix.com/zabbix-official-repo.key. * `zabbix_repo_deb_include_deb_src`: True, if deb-src should be included in the zabbix.sources entry. Default `true`. +* `zabbix_manage_repo`: Have the collection install and configure the Zabbix repo Default `true`. ### SElinux diff --git a/docs/ZABBIX_JAVAGATEWAY_ROLE.md b/docs/ZABBIX_JAVAGATEWAY_ROLE.md index 149ae05b3..9207b1c6c 100644 --- a/docs/ZABBIX_JAVAGATEWAY_ROLE.md +++ b/docs/ZABBIX_JAVAGATEWAY_ROLE.md @@ -64,6 +64,7 @@ The `zabbix_javagateway_version` is optional. The latest available major.minor v * `zabbix_repo_deb_component`: The repository component for Debian installs. Default `main`. * `zabbix_repo_deb_gpg_key_url`: The URL to download the Zabbix GPG key from. Default `http://repo.zabbix.com/zabbix-official-repo.key`. * `zabbix_repo_deb_include_deb_src`: True, if deb-src should be included in the zabbix.sources entry. Default `true`. +* `zabbix_manage_repo`: Have the collection install and configure the Zabbix repo Default `true`. ### Java Gatewaty diff --git a/docs/ZABBIX_PROXY_ROLE.md b/docs/ZABBIX_PROXY_ROLE.md index 5aaeb36e5..9dd044aa5 100644 --- a/docs/ZABBIX_PROXY_ROLE.md +++ b/docs/ZABBIX_PROXY_ROLE.md @@ -105,6 +105,7 @@ The following is an overview of all available configuration default for this rol * `zabbix_proxy_manage_service`: Default: `True`. When you run multiple Zabbix proxies in a High Available cluster setup (e.g. pacemaker), you don't want Ansible to manage the zabbix-proxy service, because Pacemaker is in control of zabbix-proxy service. * `zabbix_proxy_include_mode`: Default: `0755`. The "mode" for the directory configured with `zabbix_proxy_include`. * `zabbix_proxy_conf_mode`: Default: `0644`. The "mode" for the Zabbix configuration file. +* `zabbix_manage_repo`: Have the collection install and configure the Zabbix repo Default `true`. ### Database specific diff --git a/docs/ZABBIX_MANAGE_REPO_ROLE.md b/docs/ZABBIX_REPO_ROLE.md similarity index 98% rename from docs/ZABBIX_MANAGE_REPO_ROLE.md rename to docs/ZABBIX_REPO_ROLE.md index dd3308672..68aa633d9 100644 --- a/docs/ZABBIX_MANAGE_REPO_ROLE.md +++ b/docs/ZABBIX_REPO_ROLE.md @@ -76,7 +76,7 @@ Including an example of how to use your role (for instance, with variables passe ```yaml - hosts: zabbix-server roles: - - role: community.zabbix.zabbix_manage_repo + - role: community.zabbix.zabbix_repo ``` # License diff --git a/docs/ZABBIX_SERVER_ROLE.md b/docs/ZABBIX_SERVER_ROLE.md index dd3dd30f8..927986784 100644 --- a/docs/ZABBIX_SERVER_ROLE.md +++ b/docs/ZABBIX_SERVER_ROLE.md @@ -103,15 +103,11 @@ The following is an overview of all available configuration default for this rol * `zabbix_server_version`: Optional. The latest available major.minor version of Zabbix will be installed on the host(s). If you want to use an older version, please specify this in the major.minor format. Example: `zabbix_server_version: 6.0`. * `zabbix_server_version_minor`: When you want to specify a minor version to be installed. RedHat only. Default set to: `*` (latest available) -* `zabbix_repo_yum`: A list with Yum repository configuration. -* `zabbix_repo_yum_schema`: Default: `https`. Option to change the web schema for the yum repository(http/https) * `zabbix_server_disable_repo`: A list of repos to disable during install. Default `epel`. * `zabbix_service_state`: Default: `started`. Can be overridden to stopped if needed * `zabbix_service_enabled`: Default: `True` Can be overridden to `False` if needed -* `zabbix_repo_deb_url`: The URL to the Zabbix repository. Default `http://repo.zabbix.com/zabbix/{{ zabbix_server_version }}/{{ ansible_distribution.lower() }}` -* `zabbix_repo_deb_component`: The repository component for Debian installs. Default `main`. -* `zabbix_repo_deb_gpg_key_url`: The URL to download the Zabbix GPG key from. Default `http://repo.zabbix.com/zabbix-official-repo.key`. -* `zabbix_repo_deb_include_deb_src`: True, if deb-src should be included in the zabbix.sources entry. Default `true`. +* `zabbix_manage_repo`: Have the collection install and configure the Zabbix repo Default `true`. + ### SElinux diff --git a/docs/ZABBIX_WEB_ROLE.md b/docs/ZABBIX_WEB_ROLE.md index 120bb0cb7..0de245f41 100644 --- a/docs/ZABBIX_WEB_ROLE.md +++ b/docs/ZABBIX_WEB_ROLE.md @@ -88,16 +88,12 @@ The following is an overview of all available configuration defaults for this ro * `zabbix_web_version`: Optional. The latest available major.minor version of Zabbix will be installed on the host(s). If you want to use an older version, please specify this in the major.minor format. Example: `zabbix_web_version: 6.0`. * `zabbix_web_version_minor`: When you want to specify a minor version to be installed. RedHat only. Default set to: `*` (latest available) -* `zabbix_repo_yum`: A list with Yum repository configuration. -* `zabbix_repo_yum_schema`: Default: `https`. Option to change the web schema for the yum repository(http/https) * `zabbix_web_disable_repo`: A list of repos to disable during install. Default `epel`. * `zabbix_web_package_state`: Default: `present`. Can be overridden to `latest` to update packages when needed. * `zabbix_web_doubleprecision`: Default: `False`. For upgraded installations, please read database [upgrade notes](https://www.zabbix.com/documentation/current/manual/installation/upgrade_notes_500) (Paragraph "Enabling extended range of numeric (float) values") before enabling this option. * `zabbix_web_conf_mode`: Default: `0644`. The "mode" for the Zabbix configuration file. -* `zabbix_repo_deb_url`: The URL to the Zabbix repository. Default `http://repo.zabbix.com/zabbix/{{ zabbix_web_version }}/{{ ansible_distribution.lower() }}` -* `zabbix_repo_deb_component`: The repository component for Debian installs. Default `main`. -* `zabbix_repo_deb_gpg_key_url`: The URL to download the Zabbix GPG key from. Default `http://repo.zabbix.com/zabbix-official-repo.key`. -* `zabbix_repo_deb_include_deb_src`: True, if deb-src should be included in the zabbix.sources entry. Default `true`. +* `zabbix_manage_repo`: Have the collection install and configure the Zabbix repo Default `true`. + ### Zabbix Web specific diff --git a/molecule/zabbix_manage_repo/converge.yml b/molecule/zabbix_manage_repo/converge.yml index ca3971776..52433ba46 100644 --- a/molecule/zabbix_manage_repo/converge.yml +++ b/molecule/zabbix_manage_repo/converge.yml @@ -1,4 +1,4 @@ --- - hosts: all roles: - - role: zabbix_manage_repo + - role: zabbix_repo diff --git a/roles/zabbix_agent/tasks/main.yml b/roles/zabbix_agent/tasks/main.yml index 1d1316460..22d5ae3e6 100644 --- a/roles/zabbix_agent/tasks/main.yml +++ b/roles/zabbix_agent/tasks/main.yml @@ -89,11 +89,12 @@ - name: Install Repository ansible.builtin.include_role: - name: community.zabbix.zabbix_manage_repo + name: community.zabbix.zabbix_repo vars: zabbix_repo_version: "{{ zabbix_agent_version }}" zabbix_repo_package: "{{ zabbix_agent_package }}" zabbix_repo_apt_priority: "{{ zabbix_agent_apt_priority | default (omit) }}" + when: zabbix_manage_repo | default(true) - name: "Install the correct repository" ansible.builtin.include_tasks: "{{ ansible_os_family }}.yml" diff --git a/roles/zabbix_javagateway/tasks/main.yml b/roles/zabbix_javagateway/tasks/main.yml index 0423af300..529af73a6 100644 --- a/roles/zabbix_javagateway/tasks/main.yml +++ b/roles/zabbix_javagateway/tasks/main.yml @@ -24,11 +24,12 @@ - name: Install Repository ansible.builtin.include_role: - name: community.zabbix.zabbix_manage_repo + name: community.zabbix.zabbix_repo vars: zabbix_repo_apt_priority: "{{ zabbix_proxy_javagateway_priority | default (omit) }}" zabbix_repo_version: "{{ zabbix_javagateway_version }}" zabbix_repo_package: "zabbix-java-gateway" + when: zabbix_manage_repo | default(true) - name: "Install the correct repository" ansible.builtin.include_tasks: "{{ ansible_os_family }}.yml" diff --git a/roles/zabbix_manage_repo/README.md b/roles/zabbix_manage_repo/README.md deleted file mode 120000 index 643331b63..000000000 --- a/roles/zabbix_manage_repo/README.md +++ /dev/null @@ -1 +0,0 @@ -../../docs/ZABBIX_SERVER_ROLE.md \ No newline at end of file diff --git a/roles/zabbix_proxy/tasks/Debian.yml b/roles/zabbix_proxy/tasks/Debian.yml deleted file mode 100644 index dea9461d7..000000000 --- a/roles/zabbix_proxy/tasks/Debian.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: "Debian | Set some facts for Zabbix" - ansible.builtin.set_fact: - datafiles_path: /usr/share/doc/zabbix-sql-scripts/{{ zabbix_proxy_db_long }} - tags: - - install - - config diff --git a/roles/zabbix_proxy/tasks/RedHat.yml b/roles/zabbix_proxy/tasks/RedHat.yml deleted file mode 100644 index 5dfa847fb..000000000 --- a/roles/zabbix_proxy/tasks/RedHat.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# Tasks specific for RedHat systems - -- name: "Configure SELinux when enabled" - ansible.builtin.include_tasks: selinux.yml - when: - - zabbix_proxy_selinux | bool diff --git a/roles/zabbix_proxy/tasks/main.yml b/roles/zabbix_proxy/tasks/main.yml index ab3754d18..5b565aa55 100644 --- a/roles/zabbix_proxy/tasks/main.yml +++ b/roles/zabbix_proxy/tasks/main.yml @@ -47,14 +47,18 @@ - name: Install Repository ansible.builtin.include_role: - name: community.zabbix.zabbix_manage_repo + name: community.zabbix.zabbix_repo vars: zabbix_repo_apt_priority: "{{ zabbix_proxy_apt_priority | default (omit) }}" zabbix_repo_version: "{{ zabbix_proxy_version }}" zabbix_repo_package: "zabbix-proxy-{{ zabbix_proxy_database }}" + when: zabbix_manage_repo | default(true) -# - name: "Complete OS Specific Tasks" -# ansible.builtin.include_tasks: "{{ ansible_os_family }}.yml" +- name: "Configure SELinux when enabled" + ansible.builtin.include_tasks: selinux.yml + when: + - zabbix_proxy_selinux | bool + - ansiblle_os_family == "RedHat" - name: "Install zabbix-proxy packages" ansible.builtin.package: diff --git a/roles/zabbix_repo/README.md b/roles/zabbix_repo/README.md new file mode 120000 index 000000000..28683b139 --- /dev/null +++ b/roles/zabbix_repo/README.md @@ -0,0 +1 @@ +../../docs/ZABBIX_REPO_ROLE.md \ No newline at end of file diff --git a/roles/zabbix_manage_repo/defaults/main.yml b/roles/zabbix_repo/defaults/main.yml similarity index 100% rename from roles/zabbix_manage_repo/defaults/main.yml rename to roles/zabbix_repo/defaults/main.yml diff --git a/roles/zabbix_manage_repo/handlers/main.yml b/roles/zabbix_repo/handlers/main.yml similarity index 100% rename from roles/zabbix_manage_repo/handlers/main.yml rename to roles/zabbix_repo/handlers/main.yml diff --git a/roles/zabbix_manage_repo/meta/main.yml b/roles/zabbix_repo/meta/main.yml similarity index 100% rename from roles/zabbix_manage_repo/meta/main.yml rename to roles/zabbix_repo/meta/main.yml diff --git a/roles/zabbix_manage_repo/tasks/Debian.yml b/roles/zabbix_repo/tasks/Debian.yml similarity index 100% rename from roles/zabbix_manage_repo/tasks/Debian.yml rename to roles/zabbix_repo/tasks/Debian.yml diff --git a/roles/zabbix_manage_repo/tasks/RedHat.yml b/roles/zabbix_repo/tasks/RedHat.yml similarity index 100% rename from roles/zabbix_manage_repo/tasks/RedHat.yml rename to roles/zabbix_repo/tasks/RedHat.yml diff --git a/roles/zabbix_manage_repo/tasks/main.yml b/roles/zabbix_repo/tasks/main.yml similarity index 100% rename from roles/zabbix_manage_repo/tasks/main.yml rename to roles/zabbix_repo/tasks/main.yml diff --git a/roles/zabbix_manage_repo/vars/Debian.yml b/roles/zabbix_repo/vars/Debian.yml similarity index 100% rename from roles/zabbix_manage_repo/vars/Debian.yml rename to roles/zabbix_repo/vars/Debian.yml diff --git a/roles/zabbix_manage_repo/vars/RedHat.yml b/roles/zabbix_repo/vars/RedHat.yml similarity index 100% rename from roles/zabbix_manage_repo/vars/RedHat.yml rename to roles/zabbix_repo/vars/RedHat.yml diff --git a/roles/zabbix_manage_repo/vars/main.yml b/roles/zabbix_repo/vars/main.yml similarity index 100% rename from roles/zabbix_manage_repo/vars/main.yml rename to roles/zabbix_repo/vars/main.yml diff --git a/roles/zabbix_server/tasks/Debian.yml b/roles/zabbix_server/tasks/Debian.yml deleted file mode 100644 index ed97d539c..000000000 --- a/roles/zabbix_server/tasks/Debian.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/roles/zabbix_server/tasks/RedHat.yml b/roles/zabbix_server/tasks/RedHat.yml deleted file mode 100644 index 5a12e2d35..000000000 --- a/roles/zabbix_server/tasks/RedHat.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -# Tasks specific for RedHat systems - -- name: "RedHat | Configure SELinux when enabled" - ansible.builtin.include_tasks: selinux.yml - when: ansible_facts.selinux.status | default('disabled') == 'enabled' diff --git a/roles/zabbix_server/tasks/main.yml b/roles/zabbix_server/tasks/main.yml index 292371165..f0c8cc242 100644 --- a/roles/zabbix_server/tasks/main.yml +++ b/roles/zabbix_server/tasks/main.yml @@ -29,11 +29,18 @@ - name: Install Repository ansible.builtin.include_role: - name: community.zabbix.zabbix_manage_repo + name: community.zabbix.zabbix_repo vars: zabbix_repo_apt_priority: "{{ zabbix_server_apt_priority | default (omit) }}" zabbix_repo_version: "{{ zabbix_server_version }}" zabbix_repo_package: "zabbix_server-{{ zabbix_proxy_database }}" + when: zabbix_manage_repo | default(true) + +- name: "Configure SELinux when enabled" + ansible.builtin.include_tasks: selinux.yml + when: + - zabbix_proxy_selinux | bool + - ansiblle_os_family == "RedHat" - name: Install zabbix-server packages ansible.builtin.package: diff --git a/roles/zabbix_web/tasks/main.yml b/roles/zabbix_web/tasks/main.yml index 37984aa54..157a94825 100644 --- a/roles/zabbix_web/tasks/main.yml +++ b/roles/zabbix_web/tasks/main.yml @@ -52,11 +52,12 @@ - name: Install Repository ansible.builtin.include_role: - name: community.zabbix.zabbix_manage_repo + name: community.zabbix.zabbix_repo vars: zabbix_repo_version: "{{ zabbix_web_version }}" zabbix_repo_package: "zabbix-web-service" zabbix_repo_apt_priority: "{{ zabbix_web_apt_priority | default (omit) }}" + when: zabbix_manage_repo | default(true) - name: Include OS Specific Tasks ansible.builtin.include_tasks: "{{ ansible_os_family }}.yml"