Use ansible_facts[] instead of fact variables

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

Change-Id: Ic75eac3e27fd542370a04f9bd946d907f0756061
This commit is contained in:
Jonathan Rosser 2021-03-01 10:29:14 +00:00
parent 4a2f3e3351
commit 049a1aed1e
4 changed files with 14 additions and 14 deletions

View File

@ -35,7 +35,7 @@ tempest_pip_package_state: "latest"
# for the service setup. The host must already have
# clouds.yaml properly configured.
tempest_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}"
tempest_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((tempest_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
tempest_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((tempest_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
# Toggle whether tempest actually executes
tempest_run: no
@ -85,7 +85,7 @@ tempest_log_dir: "/var/log/tempest"
tempest_plugins: "{{ _tempest_plugins.values() | sum(start=[]) | selectattr('install', 'equalto', true) | list }}"
# tempest_workspace where tempest can be runned
tempest_workspace: "{{ ansible_env.HOME }}/workspace"
tempest_workspace: "{{ ansible_facts['env']['HOME'] }}/workspace"
# The location where the test whitelist/blacklist will be placed
tempest_test_whitelist_file_path: "{{ tempest_workspace }}/etc/tempest_whitelist.txt"
@ -262,7 +262,7 @@ tempest_pip_packages:
# name: ... name to use when uploading to glance (optional)
# properties: a dict of custom properties to attach to the image in glance (optional)
# <property>: <value>
tempest_images: "{{ tempest_images_map[ansible_architecture] }}"
tempest_images: "{{ tempest_images_map[ansible_facts['architecture']] }}"
# The location where images are downloaded to
tempest_image_dir: "{{ lookup('env', 'HOME') }}/tempest-images"

View File

@ -16,12 +16,12 @@
- 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 }}-{{ ansible_distribution_version.split('.')[0] }}.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 }}-{{ ansible_facts['distribution_version'].split('.')[0] }}.yml"
- "{{ ansible_facts['os_family'] | lower }}.yml"
tags:
- always
@ -35,7 +35,7 @@
- name: Gather variables for source installs
include_vars: source_install.yml
when:
- ((tempest_install_method == 'source') or (tempest_install_method == 'distro' and ansible_distribution == 'Ubuntu'))
- ((tempest_install_method == 'source') or (tempest_install_method == 'distro' and ansible_facts['distribution'] == 'Ubuntu'))
tags:
- always

View File

@ -18,8 +18,8 @@
package:
name: "{{ tempest_package_list }}"
state: "{{ tempest_package_state }}"
update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
update_cache: "{{ (ansible_facts['pkg_mgr'] in ['apt', 'zypper']) | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(cache_timeout, omit) }}"
register: install_packages
until: install_packages is success
retries: 5
@ -31,7 +31,7 @@
# in defaults as in case of non-integrated tests meta handlers from other roles might fail.
- name: Install Tempest packages from PIP
import_tasks: tempest_install_source.yml
when: (tempest_install_method | default('source')) == 'source' or (tempest_install_method == 'distro' and ansible_distribution == 'Ubuntu')
when: (tempest_install_method | default('source')) == 'source' or (tempest_install_method == 'distro' and ansible_facts['distribution'] == 'Ubuntu')
- name: Install stackviz on venv
import_role:

View File

@ -42,7 +42,7 @@ live_migration = false
block_migration_for_live_migration = false
block_migrate_cinder_iscsi = false
spice_console = true
config_drive = {{ ansible_architecture != 'aarch64' }}
config_drive = {{ ansible_facts['architecture'] != 'aarch64' }}
rescue = false
enable_instance_password = {{ tempest_enable_instance_password }}
interface_attach = false