From d1b30c528519ab3c82a992e6cade7e6044a1469c Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Wed, 30 Sep 2026 14:31:56 +0200 Subject: [PATCH] install-ansible: Now uses dnf on Red Hat based systems pipx is not available in the default RHEL repositories. Install the distro packages instead, as recommended by Ansible. The full install requires EPEL. See: https://docs.ansible.com/ansible/latest/installation_guide/installation_distros.html Co-Authored-By: Claude Opus 5.5 Signed-off-by: Lars Erik Wik --- software/install-ansible/README.md | 4 ++++ software/install-ansible/install-ansible.cf | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/software/install-ansible/README.md b/software/install-ansible/README.md index d5f7242..c35647d 100644 --- a/software/install-ansible/README.md +++ b/software/install-ansible/README.md @@ -13,3 +13,7 @@ Additionally it is possible to request a specific version other than the latest/ - `data:install_ansible.version` - if this variable is defined then a specific version will be installed Note that the system in question must have a `pipx` package available through the default package manager as well as python installed which should come along as a dependency of `pipx`. + +On Red Hat based systems, Ansible is installed with `dnf` instead of `pipx`. +The minimal install uses the `ansible-core` package from the default repositories. +The full install uses the `ansible` package, which requires the EPEL repository to be enabled. diff --git a/software/install-ansible/install-ansible.cf b/software/install-ansible/install-ansible.cf index b705fb6..04ac1c6 100644 --- a/software/install-ansible/install-ansible.cf +++ b/software/install-ansible/install-ansible.cf @@ -36,16 +36,27 @@ bundle agent install_ansible_main if => not(isvariable("data:install_ansible.version")); data:ansible_minimal_install:: + "package" string => "ansible-core"; "base_command" string => "pipx install --global ansible-core"; data:ansible_full_install|(!data:ansible_full_install.!data:ansible_minimal_install):: + "package" string => "ansible"; "base_command" string => "pipx install --global --include-deps ansible"; packages: - "pipx" classes => if_ok("pipx_installed"); + # Use the distro packages on Red Hat, as recommended by Ansible + redhat:: + "${package}" + version => "${data:install_ansible.version}", + if => isvariable("data:install_ansible.version"); + + "${package}" if => not(isvariable("data:install_ansible.version")); + + !redhat:: + "pipx" classes => if_ok("pipx_installed"); commands: - pipx_installed.!ansible_installed:: + !redhat.pipx_installed.!ansible_installed:: "${install_ansible_command}" contain => in_shell_umask(022), comment => "The default umask of 077 would create /opt/pipx/venvs/ansible which is inaccessible to everyone but root, so use 022 instead.";