Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/templates/fake_realm.py.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!{{ ansible_python.executable }}
#!{{ ansible_facts['python']['executable'] }}
import argparse
import os
import sys
Expand Down
10 changes: 5 additions & 5 deletions tests/tests_dyndns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/tests_full_integration_dyndns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@
- 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:
name: linux-system-roles.ad_integration
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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/tests_include_vars_from_parent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand Down
4 changes: 2 additions & 2 deletions tests/vars/rh_distros_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
4 changes: 2 additions & 2 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading