Use ansible_facts[] instead of fact variables

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

Change-Id: I29de46e830e0a63c1da90043ec08c5dcc56b7e3e
This commit is contained in:
Jonathan Rosser 2021-03-16 08:23:10 +00:00 committed by Dmitriy Rabotyagov
parent d14cd8cea4
commit f67c296bff
3 changed files with 10 additions and 10 deletions

View File

@ -24,7 +24,7 @@ trove_venv_python_executable: "{{ openstack_venv_python_executable | default('py
# for the service setup. The host must already have
# clouds.yaml properly configured.
trove_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}"
trove_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((trove_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
trove_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((trove_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
trove_package_state: "{{ package_state | default('latest') }}"
@ -65,11 +65,11 @@ trove_profiler_enabled: false
## Cap the maximum number of threads / workers when a user value is unspecified.
trove_api_workers_max: 16
trove_api_workers: "{{ [[(ansible_processor_vcpus//ansible_processor_threads_per_core)|default(1), 1] | max * 2, trove_api_workers_max] | min }}"
trove_api_workers: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, trove_api_workers_max] | min }}"
## Cap the maximum number of threads / workers when a user value is unspecified.
trove_conductor_workers_max: 16
trove_conductor_workers: "{{ [[(ansible_processor_vcpus//ansible_processor_threads_per_core)|default(1), 1] | max * 2, trove_conductor_workers_max] | min }}"
trove_conductor_workers: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, trove_conductor_workers_max] | min }}"
# Enable/Disable Ceilometer
trove_ceilometer_enabled: "{{ (groups['ceilometer_all'] is defined) and (groups['ceilometer_all'] | length > 0) }}"
@ -88,7 +88,7 @@ trove_git_constraints:
# Database vars
trove_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
trove_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((trove_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
trove_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((trove_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
trove_galera_address: "{{ galera_address | default('127.0.0.1') }}"
trove_galera_database_name: trove
trove_galera_user: trove

View File

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

View File

@ -19,11 +19,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