Use ansible_facts[] instead of fact variables in group_vars

See https://github.com/ansible/ansible/issues/73654

Change-Id: I06ab9cee6539762d7ba3e25e07b5661a8fa485f3
This commit is contained in:
Jonathan Rosser 2021-03-01 13:23:43 +00:00
parent 75bb7cfbfe
commit 6c94ac8515
9 changed files with 19 additions and 19 deletions

View File

@ -41,16 +41,16 @@ openstack_service_bind_address: "{{ management_address }}"
# Options are 'present' and 'latest'.
# NOTE(mhayden): Allowing CentOS and openSUSE to use package_state=present should give
# gate jobs a better chance to finish and expose more issues to fix.
package_state: "{{ (ansible_pkg_mgr in ['dnf', 'zypper']) | ternary('present', 'latest') }}"
package_state: "{{ (ansible_facts['pkg_mgr'] in ['dnf', 'zypper']) | ternary('present', 'latest') }}"
# Set "/var/log" to be a bind mount to the physical host.
default_bind_mount_logs: true
# Set distro variable
# NOTE(hwoarang): ansible_distribution may return a string with spaces
# NOTE(hwoarang): ansible_facts['distribution'] may return a string with spaces
# such as "openSUSE Leap" so we need to replace the space with underscore
# in order to create a more sensible repo name for the distro.
os_distro_version: "{{ (ansible_distribution | lower) | replace(' ', '_') }}-{{ ansible_distribution_version.split('.')[:2] | join('.') }}-{{ ansible_architecture | lower }}"
os_distro_version: "{{ (ansible_facts['distribution'] | lower) | replace(' ', '_') }}-{{ ansible_facts['distribution_version'].split('.')[:2] | join('.') }}-{{ ansible_facts['architecture'] | lower }}"
# Set the systemd prefix based on the base OS.
systemd_utils_distro_prefix:
@ -59,15 +59,15 @@ systemd_utils_distro_prefix:
dnf: "/lib/systemd"
zypper: "/usr/lib/systemd"
systemd_utils_prefix: "{{ systemd_utils_distro_prefix[ansible_pkg_mgr] }}"
systemd_utils_prefix: "{{ systemd_utils_distro_prefix[ansible_facts['pkg_mgr']] }}"
# Ensure that the package state matches the global setting
rsyslog_client_package_state: "{{ package_state }}"
# At this time there's no suitable package available for systemd-journal-remote/gateway
# When installing on SUSE 42.x. For now this playbook will omit suse when the package
# manager is "zypper". When a suitable package is available on SUSE this should be removed.
rsyslog_client_enabled: "{{ ansible_pkg_mgr == 'zypper' }}"
rsyslog_server_enabled: "{{ ansible_pkg_mgr == 'zypper' }}"
rsyslog_client_enabled: "{{ ansible_facts['pkg_mgr'] == 'zypper' }}"
rsyslog_server_enabled: "{{ ansible_facts['pkg_mgr'] == 'zypper' }}"
# URL for the frozen internal openstack repo.
repo_server_port: 8181

View File

@ -22,7 +22,7 @@ osd_group_name: ceph-osd
rgw_group_name: ceph-rgw
mds_group_name: ceph-mds
nfs_group_name: ceph-nfs
ceph_origin: "{{ (ansible_pkg_mgr == 'zypper') | ternary('distro', 'repository') }}"
ceph_origin: "{{ (ansible_facts['pkg_mgr'] == 'zypper') | ternary('distro', 'repository') }}"
ceph_repository: community
# The _stable_release var is used by both the OSA ceph_client role and the
# ceph-ansible roles. It is defaulted in ceph_client but set here to keep the

View File

@ -16,7 +16,7 @@
# This is the default LXC AppArmor profile
# Groups which need the unbound profile have a specific override
lxc_container_config_list:
- "lxc.apparmor.profile={{ (hostvars[physical_host]['ansible_distribution'] == 'Debian' and hostvars[physical_host]['ansible_distribution_major_version'] == '10' ) | ternary('unconfined', 'lxc-openstack') }}"
- "lxc.apparmor.profile={{ (hostvars[physical_host]['ansible_facts']['distribution'] == 'Debian' and hostvars[physical_host]['ansible_facts']['distribution_major_version'] == '10' ) | ternary('unconfined', 'lxc-openstack') }}"
# Needed by playbooks/common-tasks/os-lxc-container-setup.yml
lxc_container_log_path: "/var/log/lxc"

View File

@ -38,7 +38,7 @@ ceph_conf_overrides: "{{ (ceph_conf_overrides_rgw | default({})) | combine(ceph_
# needed.
nfs_file_gw: "{{ (('ceph-nfs' in groups) and ('ceph-mds' in groups)) }}"
nfs_obj_gw: False
nfs_ganesha_stable: "{{ (ansible_distribution_release not in ['bionic', 'focal']) }}"
nfs_ganesha_stable: "{{ (ansible_facts['distribution_release'] not in ['bionic', 'focal']) }}"
# NTP in an OSA environment is handled by ansible-hardening using chrony
# ceph-ansible's default enabling of ntpd conflicts with the OSA defaults

View File

@ -16,7 +16,7 @@
keepalived_ping_count: 1
keepalived_ping_interval: 10
keepalived_ubuntu_src: "native"
keepalived_ping_address: "{{ ansible_default_ipv4['gateway'] | default('127.0.0.1') }}"
keepalived_ping_address: "{{ ansible_facts['default_ipv4']['gateway'] | default('127.0.0.1') }}"
keepalived_sync_groups:
haproxy:

View File

@ -23,7 +23,7 @@ stig_version: rhel7
# Temporarily avoid putting SELinux into enforcing mode on CentOS until some
# additional policy is written. See LP Bug 1657517 for more details.
security_rhel7_enable_linux_security_module: "{{ ansible_os_family == 'RedHat' | ternary(false, true) }}"
security_rhel7_enable_linux_security_module: "{{ (ansible_facts['os_family'] == 'RedHat') | ternary(false, true) }}"
# All our ansible tasks run as root user, we need to allow direct root login
security_sshd_permit_root_login: 'without-password'

View File

@ -27,15 +27,15 @@
# Set to your iBGP ASN
bird_bgp_asn: 65000
bird_bgp_ipv4_peer_ip: "{{ ansible_default_ipv4['gateway'] }}"
bird_bgp_ipv4_peer_ip: "{{ ansible_facts['default_ipv4']['gateway'] }}"
#calculate the first address in the subnet since the IPv6 "gateway" may be a
#link local address that we cannot peer to.
bird_bgp_ipv6_peer_ip: >-
{% if ansible_default_ipv6['address'] is defined
and ansible_default_ipv6['prefix'] is defined %}
{% if ansible_facts['default_ipv6']['address'] is defined
and ansible_facts['default_ipv6']['prefix'] is defined %}
{{
((ansible_default_ipv6['address'] ~ '/' ~ ansible_default_ipv6['prefix']) |
ipaddr('network') ~ '/' ~ ansible_default_ipv6['prefix']
((ansible_facts['default_ipv6']['address'] ~ '/' ~ ansible_facts['default_ipv6']['prefix']) |
ipaddr('network') ~ '/' ~ ansible_facts['default_ipv6']['prefix']
) | ipaddr('net') | ipaddr(1) | ipaddr('address')
}}
{% endif %}

View File

@ -15,7 +15,7 @@
nova_console_type: novnc
nova_console_agent_enabled: "{{ ansible_architecture != 'aarch64' }}"
nova_console_agent_enabled: "{{ ansible_facts['architecture'] != 'aarch64' }}"
nova_novncproxy_port: 6080
nova_spice_html5proxy_base_port: 6082
nova_serialconsoleproxy_port: 6083

View File

@ -42,7 +42,7 @@ _utility_devel_distro_packages_redhat:
- libselinux-python3
- python36-devel
utility_devel_distro_packages: "{{ (ansible_os_family == 'RedHat') | ternary(_utility_devel_distro_packages_redhat, _utility_devel_distro_packages_debian) }}"
utility_devel_distro_packages: "{{ (ansible_facts['os_family'] == 'RedHat') | ternary(_utility_devel_distro_packages_redhat, _utility_devel_distro_packages_debian) }}"
# Client packages required for distro installs
utility_distro_openstack_clients_packages:
@ -90,7 +90,7 @@ tempest_main_group: utility_all
# This sets up a list of tests to execute based on what's deployed in the environment.
# The list gets added to the whitelist which tempest executes.
tempest_test_whitelist:
- "{{ (ansible_pkg_mgr == 'apt' and tempest_install_method == 'distro') |
- "{{ (ansible_facts['pkg_mgr'] == 'apt' and tempest_install_method == 'distro') |
ternary('(?!.*\\.test_list_all_implied_roles)', '') ~ 'tempest.api.identity.admin.v3' }}"
- "tempest.api.identity.v3"
- "{{ (tempest_service_available_ceilometer | bool) | ternary('tempest.api.telemetry', '') }}"