Use ansible_facts[] instead of fact variables in tests
See https://github.com/ansible/ansible/issues/73654 Change-Id: I7e27477d4fb1292aa5d79adcf6cb33eaa31da035
This commit is contained in:
parent
6c94ac8515
commit
e2c4cd43bb
@ -60,7 +60,7 @@
|
||||
PrintLastLog: no
|
||||
TCPKeepAlive: yes
|
||||
AcceptEnv: "LANG LC_*"
|
||||
Subsystem: "{{ sftp_subsystem[ansible_pkg_mgr] }}"
|
||||
Subsystem: "{{ sftp_subsystem[ansible_facts['pkg_mgr']] }}"
|
||||
UsePAM: yes
|
||||
UseDNS: no
|
||||
X11Forwarding: no
|
||||
@ -81,8 +81,10 @@
|
||||
- name: Check that new network interfaces are up
|
||||
assert:
|
||||
that:
|
||||
- ansible_eth12['active'] | bool
|
||||
- ansible_eth13['active'] | bool
|
||||
- ansible_eth14['active'] | bool
|
||||
- ansible_facts['eth12']['active'] | bool
|
||||
- ansible_facts['eth13']['active'] | bool
|
||||
- ansible_facts['eth14']['active'] | bool
|
||||
when:
|
||||
- (bootstrap_host_container_tech | default('unknown')) != 'nspawn'
|
||||
- name: Clear facts
|
||||
meta: clear_facts
|
||||
|
@ -105,7 +105,7 @@ vlan_range: "172.29.248"
|
||||
netmask: "255.255.252.0"
|
||||
#
|
||||
# NICs
|
||||
bootstrap_host_public_interface: "{{ ansible_default_ipv4.interface }}"
|
||||
bootstrap_host_public_interface: "{{ ansible_facts['default_ipv4']['interface'] }}"
|
||||
#
|
||||
# Utility paths
|
||||
bootstrap_host_network_utils:
|
||||
@ -126,9 +126,9 @@ bootstrap_host_network_utils:
|
||||
ethtool: /sbin/ethtool
|
||||
ip: /sbin/ip
|
||||
#
|
||||
bootstrap_host_iptables_path: "{{ bootstrap_host_network_utils[ansible_pkg_mgr]['iptables'] }}"
|
||||
bootstrap_host_ethtool_path: "{{ bootstrap_host_network_utils[ansible_pkg_mgr]['ethtool'] }}"
|
||||
bootstrap_host_ip_path: "{{ bootstrap_host_network_utils[ansible_pkg_mgr]['ip'] }}"
|
||||
bootstrap_host_iptables_path: "{{ bootstrap_host_network_utils[ansible_facts['pkg_mgr']]['iptables'] }}"
|
||||
bootstrap_host_ethtool_path: "{{ bootstrap_host_network_utils[ansible_facts['pkg_mgr']]['ethtool'] }}"
|
||||
bootstrap_host_ip_path: "{{ bootstrap_host_network_utils[ansible_facts['pkg_mgr']]['ip'] }}"
|
||||
|
||||
## Extra storage
|
||||
# An AIO may optionally be built using a second storage device. If a
|
||||
@ -179,9 +179,9 @@ bootstrap_host_format_options:
|
||||
#
|
||||
# Set the data disk mount options.
|
||||
bootstrap_host_data_mount_options:
|
||||
machinectl: "noatime,nodiratime,compress=lzo,commit=120,{{ (ansible_kernel is version('4.5', '>=')) | ternary('space_cache=v2', 'space_cache') }}"
|
||||
machinectl: "noatime,nodiratime,compress=lzo,commit=120,{{ (ansible_facts['kernel'] is version('4.5', '>=')) | ternary('space_cache=v2', 'space_cache') }}"
|
||||
zfs: "defaults"
|
||||
btrfs: "noatime,nodiratime,compress=lzo,commit=120,{{ (ansible_kernel is version('4.5', '>=')) | ternary('space_cache=v2', 'space_cache') }}"
|
||||
btrfs: "noatime,nodiratime,compress=lzo,commit=120,{{ (ansible_facts['kernel'] is version('4.5', '>=')) | ternary('space_cache=v2', 'space_cache') }}"
|
||||
xfs: "noatime,nodiratime,logbufs=8,logbsize=256k"
|
||||
ext4: "noatime,nobh,barrier=0,data=writeback"
|
||||
dir: "defaults"
|
||||
|
@ -16,12 +16,10 @@
|
||||
- name: Check for a supported Operating System
|
||||
assert:
|
||||
that:
|
||||
- (ansible_distribution == 'Debian' and ansible_distribution_release == 'stretch') or
|
||||
(ansible_distribution == 'Debian' and ansible_distribution_release == 'buster') or
|
||||
(ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'bionic') or
|
||||
(ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'focal') or
|
||||
(ansible_os_family == 'RedHat' and ansible_distribution_major_version == '8') or
|
||||
(ansible_os_family == 'Suse' and ansible_distribution_major_version in ['42', '15'])
|
||||
(ansible_facts['distribution'] == 'Debian' and ansible_facts['distribution_release'] == 'buster') or
|
||||
(ansible_facts['distribution'] == 'Ubuntu' and ansible_facts['distribution_release'] == 'bionic') or
|
||||
(ansible_facts['distribution'] == 'Ubuntu' and ansible_facts['distribution_release'] == 'focal') or
|
||||
(ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] == '8')
|
||||
msg: >-
|
||||
The only supported platforms for this release are Debian Stretch, Ubuntu 18.04 LTS (Bionic),
|
||||
Centos 8, openSUSE Leap 42.X and openSUSE Leap 15.X
|
||||
@ -82,14 +80,15 @@
|
||||
Can not find disk {{ bootstrap_host_data_disk_device }}
|
||||
when:
|
||||
- bootstrap_host_data_disk_device != None
|
||||
- ansible_devices.get(bootstrap_host_data_disk_device) == None
|
||||
- ansible_facts['devices'] is defined
|
||||
- ansible_facts['devices'].get(bootstrap_host_data_disk_device) == None
|
||||
tags:
|
||||
- check-disk-size
|
||||
|
||||
- name: Set data disk facts
|
||||
set_fact:
|
||||
host_data_disk_sectors: "{{ (ansible_devices[bootstrap_host_data_disk_device]['sectors'] | int) }}"
|
||||
host_data_disk_sectorsize: "{{ (ansible_devices[bootstrap_host_data_disk_device]['sectorsize'] | int) }}"
|
||||
host_data_disk_sectors: "{{ (ansible_facts['devices'][bootstrap_host_data_disk_device]['sectors'] | int) }}"
|
||||
host_data_disk_sectorsize: "{{ (ansible_facts['devices'][bootstrap_host_data_disk_device]['sectorsize'] | int) }}"
|
||||
when:
|
||||
- bootstrap_host_data_disk_device != None
|
||||
tags:
|
||||
|
@ -24,7 +24,7 @@
|
||||
package:
|
||||
name: "{{ packages_install }}"
|
||||
state: present
|
||||
update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}"
|
||||
update_cache: "{{ (ansible_facts['pkg_mgr'] in ['apt', 'zypper']) | ternary('yes', omit) }}"
|
||||
tags:
|
||||
- install-packages
|
||||
|
||||
|
@ -29,11 +29,11 @@
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
|
||||
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
|
||||
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
|
||||
- "{{ ansible_distribution | lower }}.yml"
|
||||
- "{{ ansible_os_family | lower }}.yml"
|
||||
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml"
|
||||
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
|
||||
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
|
||||
- "{{ ansible_facts['distribution'] | lower }}.yml"
|
||||
- "{{ ansible_facts['os_family'] | lower }}.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
static: no
|
||||
when:
|
||||
- bootstrap_host_loopback_swap | bool
|
||||
- ansible_swaptotal_mb < 1
|
||||
- ansible_facts['swaptotal_mb'] < 1
|
||||
tags:
|
||||
- prepare-loopback
|
||||
|
||||
|
@ -88,7 +88,7 @@
|
||||
ceph_apt_repos:
|
||||
ceph:
|
||||
state: "present"
|
||||
repo: "deb http://{{ nodepool_vars.NODEPOOL_MIRROR_HOST }}/ceph-deb-octopus {{ ansible_distribution_release }} main"
|
||||
repo: "deb http://{{ nodepool_vars.NODEPOOL_MIRROR_HOST }}/ceph-deb-octopus {{ ansible_facts['distribution_release'] }} main"
|
||||
copy:
|
||||
dest: /etc/openstack_deploy/user_openstackci.yml
|
||||
content: "{{ nodepool_overrides | to_nice_yaml }}"
|
||||
@ -118,13 +118,13 @@
|
||||
policy: targeted
|
||||
state: permissive
|
||||
when:
|
||||
- ansible_selinux.status == "enabled"
|
||||
- ansible_facts['selinux']['status'] == "enabled"
|
||||
|
||||
- name: Get systemd version
|
||||
command: "rpm -q systemd"
|
||||
changed_when: false
|
||||
register: systemd_version
|
||||
when: ansible_os_family | lower == 'redhat'
|
||||
when: ansible_facts['os_family'] | lower == 'redhat'
|
||||
|
||||
- name: Set the user_variables
|
||||
config_template:
|
||||
|
@ -47,7 +47,7 @@
|
||||
- bootstrap_host_data_disk_device_force | bool
|
||||
- item.device is search(bootstrap_host_data_disk_device)
|
||||
with_items:
|
||||
- "{{ ansible_mounts }}"
|
||||
- "{{ ansible_facts['mounts'] }}"
|
||||
|
||||
- name: Partition the whole data disk for our usage
|
||||
command: "{{ item }}"
|
||||
|
@ -17,7 +17,7 @@
|
||||
package:
|
||||
name: "{{ packages_install_zfs }}"
|
||||
state: present
|
||||
update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}"
|
||||
update_cache: "{{ (ansible_facts['pkg_mgr'] in ['apt', 'zypper']) | ternary('yes', omit) }}"
|
||||
tags:
|
||||
- install-packages
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
failed_when: firewalld_check.rc > 1
|
||||
args:
|
||||
warn: false
|
||||
when: ansible_os_family == 'RedHat'
|
||||
when: ansible_facts['os_family'] == 'RedHat'
|
||||
|
||||
- name: Disable firewalld
|
||||
become: True
|
||||
@ -31,7 +31,7 @@
|
||||
with_items:
|
||||
- firewalld
|
||||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
- ansible_facts['os_family'] == 'RedHat'
|
||||
- firewalld_check.rc == 0
|
||||
|
||||
- name: Run the systemd-networkd role
|
||||
|
@ -17,7 +17,7 @@
|
||||
package:
|
||||
name: squid
|
||||
state: present
|
||||
update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}"
|
||||
update_cache: "{{ (ansible_facts['pkg_mgr'] in ['apt', 'zypper']) | ternary('yes', omit) }}"
|
||||
notify: Restart squid
|
||||
tags:
|
||||
- install-packages
|
||||
|
@ -13,7 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
{% if ansible_os_family | lower == 'redhat' %}
|
||||
{% if ansible_facts['os_family'] | lower == 'redhat' %}
|
||||
deployment_environment_variables:
|
||||
LIBSYSTEMD_VERSION: {{ systemd_version.stdout_lines[0].split('-')[1] }}
|
||||
{% endif %}
|
||||
@ -285,7 +285,7 @@ tempest_run_concurrency: 0
|
||||
deployment_environment_variables:
|
||||
http_proxy: http://172.29.236.100:3128/
|
||||
https_proxy: http://172.29.236.100:3128/
|
||||
no_proxy: "localhost,127.0.0.1,172.29.236.100,{{ bootstrap_host_public_address | default(ansible_default_ipv4.address) }}"
|
||||
no_proxy: "localhost,127.0.0.1,172.29.236.100,{{ bootstrap_host_public_address | default(ansible_facts['default_ipv4']['address']) }}"
|
||||
|
||||
# Remove eth0 from all container so there is no default route and everything
|
||||
# must go via the http proxy
|
||||
|
Loading…
Reference in New Issue
Block a user