diff --git a/tasks/main.yml b/tasks/main.yml index f4bcee41..fbd532b3 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -8,7 +8,7 @@ msg: >- This role does not support s390x architecture. Let us know if you need the role to support it. - when: ansible_architecture == 's390x' + when: ansible_facts['architecture'] == 's390x' # null is allowed as a value for state: absent - but it is not needed # and should not be used @@ -160,3 +160,10 @@ - name: Collect bootloader facts bootloader_facts: when: bootloader_gather_facts | bool + +# With Ansible 2.20, creating variables from facts is deprecated. +# This task is a workaround to set the bootloader_facts variable. +- name: Set bootloader_facts variable + set_fact: + bootloader_facts: "{{ ansible_facts['bootloader_facts'] }}" + when: bootloader_gather_facts | bool diff --git a/tests/tasks/skip_on_s390x.yml b/tests/tasks/skip_on_s390x.yml index 6bb355d6..76cf7053 100644 --- a/tests/tasks/skip_on_s390x.yml +++ b/tests/tasks/skip_on_s390x.yml @@ -6,5 +6,5 @@ when: '"architecture" not in ansible_facts.keys() | list' - name: End host on s390x architecture - when: ansible_architecture == 's390x' + when: ansible_facts['architecture'] == 's390x' meta: end_host diff --git a/tests/tests_include_vars_from_parent.yml b/tests/tests_include_vars_from_parent.yml index 432af8fb..175814b6 100644 --- a/tests/tests_include_vars_from_parent.yml +++ b/tests/tests_include_vars_from_parent.yml @@ -36,11 +36,11 @@ # 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 ba453a99..fd9b377e 100644 --- a/tests/vars/rh_distros_vars.yml +++ b/tests/vars/rh_distros_vars.yml @@ -14,7 +14,7 @@ __bootloader_rh_distros: __bootloader_rh_distros_fedora: "{{ __bootloader_rh_distros + ['Fedora'] }}" # Use this in conditionals to check if distro is Red Hat or clone -__bootloader_is_rh_distro: "{{ ansible_distribution in __bootloader_rh_distros }}" +__bootloader_is_rh_distro: "{{ ansible_facts['distribution'] in __bootloader_rh_distros }}" # Use this in conditionals to check if distro is Red Hat or clone, or Fedora -__bootloader_is_rh_distro_fedora: "{{ ansible_distribution in __bootloader_rh_distros_fedora }}" +__bootloader_is_rh_distro_fedora: "{{ ansible_facts['distribution'] in __bootloader_rh_distros_fedora }}" diff --git a/vars/main.yml b/vars/main.yml index 4be9c69e..8fe39984 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -16,9 +16,9 @@ __bootloader_packages: - grubby __bootloader_default_grub: /etc/default/grub __bootloader_uefi_conf_dir: >- - {%- if ansible_os_family == 'RedHat' -%} - /boot/efi/EFI/{{ ansible_distribution | lower }}/ - {%- elif ansible_os_family == 'Suse' -%} + {%- if ansible_facts['os_family'] == 'RedHat' -%} + /boot/efi/EFI/{{ ansible_facts['distribution'] | lower }}/ + {%- elif ansible_facts['os_family'] == 'Suse' -%} /boot/efi/EFI/BOOT/ {%- endif -%} __bootloader_bios_conf_dir: /boot/grub2/ @@ -35,8 +35,8 @@ __bootloader_rh_distros: __bootloader_rh_distros_fedora: "{{ __bootloader_rh_distros + ['Fedora'] }}" # Use this in conditionals to check if distro is Red Hat or clone -__bootloader_is_rh_distro: "{{ ansible_distribution in __bootloader_rh_distros }}" +__bootloader_is_rh_distro: "{{ ansible_facts['distribution'] in __bootloader_rh_distros }}" # Use this in conditionals to check if distro is Red Hat or clone, or Fedora -__bootloader_is_rh_distro_fedora: "{{ ansible_distribution in __bootloader_rh_distros_fedora }}" +__bootloader_is_rh_distro_fedora: "{{ ansible_facts['distribution'] in __bootloader_rh_distros_fedora }}" # END - DO NOT EDIT THIS BLOCK - rh distros variables