Use ansible_facts[] instead of fact variables

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

Change-Id: I03b51e2cf342b8b1434503f2bd0f4b30dcd5258e
This commit is contained in:
Jonathan Rosser 2021-02-23 18:05:14 +00:00
parent b9623c530b
commit ae6c72997c
7 changed files with 15 additions and 15 deletions

View File

@ -186,7 +186,7 @@ glance_cors_allowed_origin: "{{ (glance_show_multiple_locations | bool) | ternar
## Cap the maximum number of threads / workers when a user value is unspecified. ## Cap the maximum number of threads / workers when a user value is unspecified.
glance_api_threads_max: 16 glance_api_threads_max: 16
glance_api_threads: "{{ [[(ansible_processor_vcpus//ansible_processor_threads_per_core)|default(1), 1] | max, glance_api_threads_max] | min }}" glance_api_threads: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max, glance_api_threads_max] | min }}"
glance_task_executor: taskflow glance_task_executor: taskflow
glance_digest_algorithm: sha256 glance_digest_algorithm: sha256
@ -275,7 +275,7 @@ glance_services:
# Glance uWSGI settings # Glance uWSGI settings
glance_wsgi_processes_max: 16 glance_wsgi_processes_max: 16
glance_wsgi_processes: "{{ [[(ansible_processor_vcpus//ansible_processor_threads_per_core)|default(1), 1] | max * 2, glance_wsgi_processes_max] | min }}" glance_wsgi_processes: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, glance_wsgi_processes_max] | min }}"
glance_wsgi_threads: 1 glance_wsgi_threads: 1
## Tunable overrides ## Tunable overrides

View File

@ -18,7 +18,7 @@
name: "{{ item.service_name }}" name: "{{ item.service_name }}"
enabled: yes enabled: yes
state: "stopped" state: "stopped"
daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}" daemon_reload: "{{ (ansible_facts['service_mgr'] == 'systemd') | ternary('yes', omit) }}"
with_items: "{{ filtered_glance_services }}" with_items: "{{ filtered_glance_services }}"
register: _stop register: _stop
until: _stop is success until: _stop is success
@ -33,7 +33,7 @@
name: "{{ item.service_name }}" name: "{{ item.service_name }}"
enabled: yes enabled: yes
state: "started" state: "started"
daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}" daemon_reload: "{{ (ansible_facts['service_mgr'] == 'systemd') | ternary('yes', omit) }}"
with_items: "{{ filtered_glance_services }}" with_items: "{{ filtered_glance_services }}"
register: _start register: _start
until: _start is success until: _start is success

View File

@ -42,4 +42,4 @@ galaxy_info:
dependencies: dependencies:
- role: apt_package_pinning - role: apt_package_pinning
when: when:
- ansible_pkg_mgr == 'apt' - ansible_facts['pkg_mgr'] == 'apt'

View File

@ -117,8 +117,8 @@
package: package:
name: "{{ glance_package_list }}" name: "{{ glance_package_list }}"
state: "{{ glance_package_state }}" state: "{{ glance_package_state }}"
update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}" update_cache: "{{ (ansible_facts['pkg_mgr'] in ['apt', 'zypper']) | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}" cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(cache_timeout, omit) }}"
register: install_packages register: install_packages
until: install_packages is success until: install_packages is success
retries: 5 retries: 5

View File

@ -16,12 +16,12 @@
- name: Gather variables for each operating system - name: Gather variables for each operating system
include_vars: "{{ item }}" include_vars: "{{ item }}"
with_first_found: with_first_found:
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml" - "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml" - "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml" - "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml" - "{{ ansible_facts['distribution'] | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yml" - "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_version'].split('.')[0] }}.yml"
- "{{ ansible_os_family | lower }}.yml" - "{{ ansible_facts['os_family'] | lower }}.yml"
tags: tags:
- always - always

View File

@ -22,7 +22,7 @@
- block: - block:
- name: Install NFS packages - name: Install NFS packages
package: package:
name: "{{ nfs_package[ansible_distribution | lower] }}" name: "{{ nfs_package[ansible_facts['distribution'] | lower] }}"
state: present state: present
- name: create the system group for nfs - name: create the system group for nfs

View File

@ -26,7 +26,7 @@ glance_devel_distro_packages:
glance_service_distro_packages: glance_service_distro_packages:
- openstack-glance - openstack-glance
- "{{ ansible_distribution_major_version is version('8', '<') | ternary('systemd-python', 'python3-systemd') }}" - "{{ ansible_facts['distribution_major_version'] is version('8', '<') | ternary('systemd-python', 'python3-systemd') }}"
glance_oslomsg_amqp1_distro_packages: glance_oslomsg_amqp1_distro_packages:
- cyrus-sasl-lib - cyrus-sasl-lib