diff --git a/tasks/main.yml b/tasks/main.yml index 441daf2e..33b5915d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -110,9 +110,9 @@ when: - ad_integration_manage_crypto_policies | bool # Fedora and RHEL8+ - - (ansible_distribution == "Fedora" or - (ansible_distribution in __ad_integration_rh_distros and - ansible_distribution_version is version('8', '>='))) + - (ansible_facts['distribution'] == "Fedora" or + (ansible_facts['distribution'] in __ad_integration_rh_distros and + ansible_facts['distribution_version'] is version('8', '>='))) ## RHEL9 uses the AD-SUPPORT-LEGACY policy for RC4, ## otherwise AD-SUPPORT allows it @@ -123,8 +123,8 @@ crypto_policies_policy: "DEFAULT:AD-SUPPORT-LEGACY" when: - ad_integration_allow_rc4_crypto | bool - - ansible_distribution in __ad_integration_rh_distros - - ansible_distribution_version is version('9', '>=') + - ansible_facts['distribution'] in __ad_integration_rh_distros + - ansible_facts['distribution_version'] is version('9', '>=') - name: Grab existing domain settings from sssd.conf if we want to merge when: ad_integration_sssd_merge_duplicate_sections | bool @@ -347,8 +347,8 @@ # For dynamic dns to work the machine either needs fqdn in hostname # or ad_hostname needs to be defined. - key: ad_hostname - value: "{{ ansible_hostname + '.' + ad_integration_realm | lower - | string if '.' not in ansible_hostname else '' }}" + value: "{{ ansible_facts['hostname'] + '.' + ad_integration_realm | lower + | string if '.' not in ansible_facts['hostname'] else '' }}" when: - ad_dyndns_update | bool - item.value is not none diff --git a/tests/templates/fake_realm.py.j2 b/tests/templates/fake_realm.py.j2 index c22e84fd..82c16255 100644 --- a/tests/templates/fake_realm.py.j2 +++ b/tests/templates/fake_realm.py.j2 @@ -1,4 +1,4 @@ -#!{{ ansible_python.executable }} +#!{{ ansible_facts['python']['executable'] }} import argparse import os import sys diff --git a/tests/tests_dyndns.yml b/tests/tests_dyndns.yml index 07ce3c21..38d76f3e 100644 --- a/tests/tests_dyndns.yml +++ b/tests/tests_dyndns.yml @@ -123,13 +123,13 @@ # in my situation my ansible control host is on a different network and # DNS than the VMs I am testing against. - name: Get IP for host's FQDN - command: dig +short {{ ansible_fqdn }} A + command: dig +short {{ ansible_facts['fqdn'] }} A register: dig_hostname changed_when: false failed_when: false - name: Get hostname for host's IP address - command: dig +short -x {{ ansible_default_ipv4.address }} PTR + command: dig +short -x {{ ansible_facts['default_ipv4']['address'] }} PTR register: dig_ip changed_when: false failed_when: false @@ -138,9 +138,9 @@ assert: that: - "'{{ dig_hostname.stdout }}' == - '{{ ansible_default_ipv4.address }}'" - - "'{{ dig_ip.stdout }}' == '{{ ansible_fqdn }}.'" - when: ansible_default_ipv4.address is defined + '{{ ansible_facts['default_ipv4']['address'] }}'" + - "'{{ dig_ip.stdout }}' == '{{ ansible_facts['fqdn'] }}.'" + when: ansible_facts['default_ipv4']['address'] is defined always: - name: Cleanup fake realm diff --git a/tests/tests_full_integration_dyndns.yml b/tests/tests_full_integration_dyndns.yml index 634e1523..46e4bfbd 100644 --- a/tests/tests_full_integration_dyndns.yml +++ b/tests/tests_full_integration_dyndns.yml @@ -70,7 +70,7 @@ - name: Debug dyndns settings debug: msg: >- - Interface {{ _ad_dyndns_iface | default(ansible_default_ipv4.interface) }} and server + Interface {{ _ad_dyndns_iface | default(ansible_facts['default_ipv4']['interface']) }} and server : {{ hostvars[groups['ad'][0]].ansible_host }} - name: Run the system role with proper config include_role: @@ -78,7 +78,7 @@ public: true vars: ad_dyndns_server: "{{ hostvars[groups['ad'][0]].ansible_host }}" - ad_dyndns_iface: "{{ _ad_dyndns_iface | default(ansible_default_ipv4.interface) }}" + ad_dyndns_iface: "{{ _ad_dyndns_iface | default(ansible_facts['default_ipv4']['interface']) }}" ad_dyndns_auth: "none" ad_dyndns_update: true ad_dyndns_refresh_interval: 60 @@ -108,13 +108,13 @@ changed_when: false - name: Get IP for host's FQDN command: >- - dig +short {{ ansible_fqdn }}.{{ + dig +short {{ ansible_facts['fqdn'] }}.{{ hostvars[groups['client'][0]].ad_integration_realm }} A register: dig_hostname changed_when: false failed_when: false - name: Get hostname for host's IP address - command: "dig +short -x {{ ansible_default_ipv4.address }} PTR" + command: "dig +short -x {{ ansible_facts['default_ipv4']['address'] }} PTR" register: dig_ip changed_when: false failed_when: false diff --git a/tests/tests_include_vars_from_parent.yml b/tests/tests_include_vars_from_parent.yml index a0b69f75..c25c76ea 100644 --- a/tests/tests_include_vars_from_parent.yml +++ b/tests/tests_include_vars_from_parent.yml @@ -30,10 +30,10 @@ # create all variants like CentOS, CentOS_8.1, CentOS-8.1, # CentOS-8, CentOS-8.1 # more formally: - # {{ ansible_distribution }}-{{ ansible_distribution_version }} - # {{ ansible_distribution }}-{{ ansible_distribution_major_version }} - # {{ ansible_distribution }} - # {{ ansible_os_family }} + # {{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_version'] }} + # {{ ansible_facts['distribution'] }}-{{ ansible_facts['distribution_major_version'] }} + # {{ ansible_facts['distribution'] }} + # {{ ansible_facts['os_family'] }} # and the same for _ as separator. varfiles: "{{ [facts['distribution']] | product(separators) | map('join') | product(versions) | map('join') | list + diff --git a/tests/vars/rh_distros_vars.yml b/tests/vars/rh_distros_vars.yml index e1ccb0d2..51e0ecfc 100644 --- a/tests/vars/rh_distros_vars.yml +++ b/tests/vars/rh_distros_vars.yml @@ -14,7 +14,7 @@ __ad_integration_rh_distros: __ad_integration_rh_distros_fedora: "{{ __ad_integration_rh_distros + ['Fedora'] }}" # Use this in conditionals to check if distro is Red Hat or clone -__ad_integration_is_rh_distro: "{{ ansible_distribution in __ad_integration_rh_distros }}" +__ad_integration_is_rh_distro: "{{ ansible_facts['distribution'] in __ad_integration_rh_distros }}" # Use this in conditionals to check if distro is Red Hat or clone, or Fedora -__ad_integration_is_rh_distro_fedora: "{{ ansible_distribution in __ad_integration_rh_distros_fedora }}" +__ad_integration_is_rh_distro_fedora: "{{ ansible_facts['distribution'] in __ad_integration_rh_distros_fedora }}" diff --git a/vars/main.yml b/vars/main.yml index ef03a178..f9d80875 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -44,8 +44,8 @@ __ad_integration_rh_distros: __ad_integration_rh_distros_fedora: "{{ __ad_integration_rh_distros + ['Fedora'] }}" # Use this in conditionals to check if distro is Red Hat or clone -__ad_integration_is_rh_distro: "{{ ansible_distribution in __ad_integration_rh_distros }}" +__ad_integration_is_rh_distro: "{{ ansible_facts['distribution'] in __ad_integration_rh_distros }}" # Use this in conditionals to check if distro is Red Hat or clone, or Fedora -__ad_integration_is_rh_distro_fedora: "{{ ansible_distribution in __ad_integration_rh_distros_fedora }}" +__ad_integration_is_rh_distro_fedora: "{{ ansible_facts['distribution'] in __ad_integration_rh_distros_fedora }}" # END - DO NOT EDIT THIS BLOCK - rh distros variables