From f63eaf46557185d4e3f26f8165738de4c61950d6 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman <rjeffman@redhat.com> Date: Thu, 26 Aug 2021 17:17:23 -0300 Subject: [PATCH] ipareplica: Modify vars loading in ansible-freeipa tests. When loading variables in all ansible-freeipa roles, it is expected that a file with these variables is present for each supported Linux distribution, and then, based on the information about the distribution provided by Ansible, the correct file is loaded. Previously, only the facts `distribution` and dinstribution version related facts were used, which required specific files, or links to files for distributions in the same "family", which will probably have the same variables set. This change adds searching for files based on the `os_family` fact, allowing distributions that follow the same family rules to be supported, without any changes to the codebase. It is still possible that a specific distribution configuration overrides the default behavior, as `os_family` has lower priority than `distribution`. For example, distributions on the `RedHat` family, like Oracle Linux, Alma Linux, and Rocky Linux, work withoutadding new files, or links to files, to fill the `vars`. Fix issue #573. Fix issue #523. --- roles/ipareplica/tasks/main.yml | 7 +++++++ roles/ipareplica/vars/CentOS-8.yml | 1 - roles/ipareplica/vars/OracleLinux-7.yml | 1 - roles/ipareplica/vars/OracleLinux-8.yml | 1 - 4 files changed, 7 insertions(+), 3 deletions(-) delete mode 120000 roles/ipareplica/vars/CentOS-8.yml delete mode 120000 roles/ipareplica/vars/OracleLinux-7.yml delete mode 120000 roles/ipareplica/vars/OracleLinux-8.yml diff --git a/roles/ipareplica/tasks/main.yml b/roles/ipareplica/tasks/main.yml index 18bbe256..967030c9 100644 --- a/roles/ipareplica/tasks/main.yml +++ b/roles/ipareplica/tasks/main.yml @@ -7,6 +7,13 @@ - "vars/{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_version'] }}.yml" - "vars/{{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }}.yml" - "vars/{{ ansible_facts['distribution'] }}.yml" + # os_family is used as a fallback for distros which are not currently + # supported, but are based on a supported distro family. For example, + # Oracle, Rocky, Alma and Alibaba linux, which are all "RedHat" based. + - "vars/{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_version'] }}.yml" + - "vars/{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_major_version'] }}.yml" + - "vars/{{ ansible_facts['os_family'] }}.yml" + # If neither distro nor family is supported, try a default configuration. - "vars/default.yml" - name: Install IPA replica diff --git a/roles/ipareplica/vars/CentOS-8.yml b/roles/ipareplica/vars/CentOS-8.yml deleted file mode 120000 index d49e1cd5..00000000 --- a/roles/ipareplica/vars/CentOS-8.yml +++ /dev/null @@ -1 +0,0 @@ -RedHat-8.yml \ No newline at end of file diff --git a/roles/ipareplica/vars/OracleLinux-7.yml b/roles/ipareplica/vars/OracleLinux-7.yml deleted file mode 120000 index 852b838d..00000000 --- a/roles/ipareplica/vars/OracleLinux-7.yml +++ /dev/null @@ -1 +0,0 @@ -RedHat-7.yml \ No newline at end of file diff --git a/roles/ipareplica/vars/OracleLinux-8.yml b/roles/ipareplica/vars/OracleLinux-8.yml deleted file mode 120000 index d49e1cd5..00000000 --- a/roles/ipareplica/vars/OracleLinux-8.yml +++ /dev/null @@ -1 +0,0 @@ -RedHat-8.yml \ No newline at end of file -- GitLab