From 2388ee2e020b4315edc08fef7fa681cdea793cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Sch=C3=BCrmann?= Date: Thu, 8 Jun 2023 10:56:11 +0200 Subject: [PATCH] Gather required facts if relevant keys in ansible_facts are missing --- roles/ipaclient/tasks/main.yml | 8 ++++++++ roles/ipareplica/tasks/main.yml | 8 ++++++++ roles/ipaserver/tasks/main.yml | 8 ++++++++ roles/ipasmartcard_client/tasks/main.yml | 8 ++++++++ roles/ipasmartcard_server/tasks/main.yml | 8 ++++++++ 5 files changed, 40 insertions(+) diff --git a/roles/ipaclient/tasks/main.yml b/roles/ipaclient/tasks/main.yml index 7bd774c7df..ac6e7338ba 100644 --- a/roles/ipaclient/tasks/main.yml +++ b/roles/ipaclient/tasks/main.yml @@ -1,6 +1,14 @@ --- # tasks file for ipaclient +- name: Gather facts + ansible.builtin.setup: + gather_subset: min + when: ansible_facts.distribution is not defined or + ansible_facts.distribution_version is not defined or + ansible_facts.distribution_major_version is not defined or + ansible_facts.os_family is not defined + - name: Import variables specific to distribution ansible.builtin.include_vars: "{{ item }}" with_first_found: diff --git a/roles/ipareplica/tasks/main.yml b/roles/ipareplica/tasks/main.yml index 943b52c541..103471427f 100644 --- a/roles/ipareplica/tasks/main.yml +++ b/roles/ipareplica/tasks/main.yml @@ -1,6 +1,14 @@ --- # tasks file for ipareplica +- name: Gather facts + ansible.builtin.setup: + gather_subset: min + when: ansible_facts.distribution is not defined or + ansible_facts.distribution_version is not defined or + ansible_facts.distribution_major_version is not defined or + ansible_facts.os_family is not defined + - name: Import variables specific to distribution ansible.builtin.include_vars: "{{ item }}" with_first_found: diff --git a/roles/ipaserver/tasks/main.yml b/roles/ipaserver/tasks/main.yml index 8e8d9b8e0a..c31c775d82 100644 --- a/roles/ipaserver/tasks/main.yml +++ b/roles/ipaserver/tasks/main.yml @@ -1,6 +1,14 @@ --- # tasks file for ipaserver +- name: Gather facts + ansible.builtin.setup: + gather_subset: min + when: ansible_facts.distribution is not defined or + ansible_facts.distribution_version is not defined or + ansible_facts.distribution_major_version is not defined or + ansible_facts.os_family is not defined + - name: Import variables specific to distribution ansible.builtin.include_vars: "{{ item }}" with_first_found: diff --git a/roles/ipasmartcard_client/tasks/main.yml b/roles/ipasmartcard_client/tasks/main.yml index 8c87a80fec..7012dd9a1e 100644 --- a/roles/ipasmartcard_client/tasks/main.yml +++ b/roles/ipasmartcard_client/tasks/main.yml @@ -6,6 +6,14 @@ msg: "Uninstalling smartcard for IPA is not supported" when: state|default('present') == 'absent' +- name: Gather facts + ansible.builtin.setup: + gather_subset: min + when: ansible_facts.distribution is not defined or + ansible_facts.distribution_version is not defined or + ansible_facts.distribution_major_version is not defined or + ansible_facts.os_family is not defined + - name: Import variables specific to distribution ansible.builtin.include_vars: "{{ item }}" with_first_found: diff --git a/roles/ipasmartcard_server/tasks/main.yml b/roles/ipasmartcard_server/tasks/main.yml index c650511eb8..22f8347844 100644 --- a/roles/ipasmartcard_server/tasks/main.yml +++ b/roles/ipasmartcard_server/tasks/main.yml @@ -6,6 +6,14 @@ msg: "Uninstalling smartcard for IPA is not supported" when: state|default('present') == 'absent' +- name: Gather facts + ansible.builtin.setup: + gather_subset: min + when: ansible_facts.distribution is not defined or + ansible_facts.distribution_version is not defined or + ansible_facts.distribution_major_version is not defined or + ansible_facts.os_family is not defined + - name: Import variables specific to distribution ansible.builtin.include_vars: "{{ item }}" with_first_found: