Merge "Use ansible_facts[] instead of fact variables"

This commit is contained in:
Zuul 2021-05-05 09:07:50 +00:00 committed by Gerrit Code Review
commit efd8b4a1a4
7 changed files with 15 additions and 15 deletions

View File

@ -18,7 +18,7 @@
# all their testing using the source-based installation of # all their testing using the source-based installation of
# tempest. As such, for all ubuntu distribution tests we # tempest. As such, for all ubuntu distribution tests we
# force the use of the source install for tempest. # force the use of the source install for tempest.
tempest_install_method: "{{ (ansible_distribution | lower == 'ubuntu') | ternary('source', 'distro') }}" tempest_install_method: "{{ (ansible_facts['distribution'] | lower == 'ubuntu') | ternary('source', 'distro') }}"
# #
# Use $role_install_method=distro so we can test the combined # Use $role_install_method=distro so we can test the combined

View File

@ -35,11 +35,11 @@
lxc_container: lxc_container:
name: "{{ container_name }}" name: "{{ container_name }}"
container_command: | container_command: |
[[ ! -d "/{{ kernel_module_path[ansible_pkg_mgr] }}" ]] && mkdir -p "/{{ kernel_module_path[ansible_pkg_mgr] }}" [[ ! -d "/{{ kernel_module_path[ansible_facts['pkg_mgr']] }}" ]] && mkdir -p "/{{ kernel_module_path[ansible_facts['pkg_mgr']] }}"
container_config: container_config:
- "lxc.apparmor.profile=unconfined" - "lxc.apparmor.profile=unconfined"
- "lxc.cgroup.devices.allow=a *:* rmw" - "lxc.cgroup.devices.allow=a *:* rmw"
- "lxc.mount.entry=/{{ kernel_module_path[ansible_pkg_mgr] }} {{ kernel_module_path[ansible_pkg_mgr] }} none bind 0 0" - "lxc.mount.entry=/{{ kernel_module_path[ansible_facts['pkg_mgr']] }} {{ kernel_module_path[ansible_facts['pkg_mgr']] }} none bind 0 0"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
- name: Wait for container connectivity - name: Wait for container connectivity
@ -70,7 +70,7 @@
# neutron wheel # neutron wheel
- name: Install packages required to build neutron python package - name: Install packages required to build neutron python package
package: package:
name: "{{ required_packages[ansible_pkg_mgr] }}" name: "{{ required_packages[ansible_facts['pkg_mgr']] }}"
state: present state: present
register: install_packages register: install_packages
until: install_packages is success until: install_packages is success

View File

@ -41,7 +41,7 @@
# nova wheel # nova wheel
- name: Install packages required to build nova python package - name: Install packages required to build nova python package
package: package:
name: "{{ required_packages[ansible_pkg_mgr] }}" name: "{{ required_packages[ansible_facts['pkg_mgr']] }}"
state: present state: present

View File

@ -60,7 +60,7 @@
# be fixed (instead of timeouts). # be fixed (instead of timeouts).
- name: Use present for package_state on CentOS - name: Use present for package_state on CentOS
set_fact: set_fact:
package_state: "{{ (ansible_pkg_mgr == 'dnf') | ternary('present', 'latest') }}" package_state: "{{ (ansible_facts['pkg_mgr'] == 'dnf') | ternary('present', 'latest') }}"
- name: Setup clouds.yaml for the test user - name: Setup clouds.yaml for the test user
include_role: include_role:
@ -193,15 +193,15 @@
' gso off sg off tso off tx off'] %} ' gso off sg off tso off tx off'] %}
{% for interface in (bridges | default([])) %} {% for interface in (bridges | default([])) %}
{% if interface is string %} {% if interface is string %}
{% set _ = veths.append('-' + iptool_path[ansible_os_family | lower] + ' link set ' + interface + ' up') %} {% set _ = veths.append('-' + iptool_path[ansible_facts['os_family'] | lower] + ' link set ' + interface + ' up') %}
{% set _ = veths.append('-/sbin/ethtool -K ' + interface + ' gso off sg off tso off tx off') %} {% set _ = veths.append('-/sbin/ethtool -K ' + interface + ' gso off sg off tso off tx off') %}
{% else %} {% else %}
{% set interface_name = (interface.name | default('br-mgmt')) %} {% set interface_name = (interface.name | default('br-mgmt')) %}
{% set _ = veths.append('-' + iptool_path[ansible_os_family | lower] + ' link set ' + interface_name + ' up') %} {% set _ = veths.append('-' + iptool_path[ansible_facts['os_family'] | lower] + ' link set ' + interface_name + ' up') %}
{% set _ = veths.append('-/sbin/ethtool -K ' + interface_name + ' gso off sg off tso off tx off') %} {% set _ = veths.append('-/sbin/ethtool -K ' + interface_name + ' gso off sg off tso off tx off') %}
{% if interface.veth_peer is defined %} {% if interface.veth_peer is defined %}
{% set _ = veths.append('-' + iptool_path[ansible_os_family | lower] + ' link set ' + interface_name + '-veth up') %} {% set _ = veths.append('-' + iptool_path[ansible_facts['os_family'] | lower] + ' link set ' + interface_name + '-veth up') %}
{% set _ = veths.append('-' + iptool_path[ansible_os_family | lower] + ' link set ' + interface.veth_peer + ' up') %} {% set _ = veths.append('-' + iptool_path[ansible_facts['os_family'] | lower] + ' link set ' + interface.veth_peer + ' up') %}
{% set _ = veths.append('-/sbin/ethtool -K ' + interface.veth_peer + ' gso off sg off tso off tx off') %} {% set _ = veths.append('-/sbin/ethtool -K ' + interface.veth_peer + ' gso off sg off tso off tx off') %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@ -32,13 +32,13 @@
package: package:
name: xfsprogs name: xfsprogs
state: present state: present
# NOTE(hwoarang) Use the ansible_pkg_mgr fact gathered by # NOTE(hwoarang) Use the ansible_facts['pkg_mgr'] fact gathered by
# the setup module for the container because package manager # the setup module for the container because package manager
# detection does not work as expected when the task is delegated. # detection does not work as expected when the task is delegated.
# The reason is that the package module expects hostvars['%s']['ansible_pkg_mgr'] # The reason is that the package module expects hostvars['%s']['ansible_facts']['pkg_mgr']
# to be populated on delegated tasks but this is not the case here # to be populated on delegated tasks but this is not the case here
# because we haven't run the setup module on localhost. # because we haven't run the setup module on localhost.
use: "{{ ansible_pkg_mgr }}" use: "{{ ansible_facts['pkg_mgr'] }}"
delegate_to: "{{ physical_host }}" delegate_to: "{{ physical_host }}"
run_once: true run_once: true

View File

@ -69,7 +69,7 @@ lxc_net_bridge: lxcbr0
lxc_kernel_options: lxc_kernel_options:
- { key: 'fs.inotify.max_user_instances', value: 1024 } - { key: 'fs.inotify.max_user_instances', value: 1024 }
lxc_container_config_list: lxc_container_config_list:
- "lxc.apparmor.profile={{ (hostvars[physical_host]['ansible_distribution'] == 'Debian') | ternary('unconfined', 'lxc-openstack') }}" - "lxc.apparmor.profile={{ (hostvars[physical_host]['ansible_facts']['distribution'] == 'Debian') | ternary('unconfined', 'lxc-openstack') }}"
is_metal: "{{ not (ansible_facts['virtualization_type'] in ['lxc', 'systemd-nspawn']) }}" is_metal: "{{ not (ansible_facts['virtualization_type'] in ['lxc', 'systemd-nspawn']) }}"

View File

@ -24,7 +24,7 @@
regexp: 'https' regexp: 'https'
replace: "http" replace: "http"
when: when:
- ansible_distribution_release in ['bionic', 'focal'] - ansible_facts['distribution_release'] in ['bionic', 'focal']
- name: Remove package blacklist for dnf - name: Remove package blacklist for dnf
lineinfile: lineinfile: