Merge "Use ansible_facts[] instead of fact variables"

This commit is contained in:
Zuul 2021-03-16 16:04:49 +00:00 committed by Gerrit Code Review
commit 992ab38b61
14 changed files with 20 additions and 20 deletions

View File

@ -24,7 +24,7 @@ debug: False
# for the service setup. The host must already have
# clouds.yaml properly configured.
swift_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}"
swift_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((swift_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
swift_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((swift_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
# Set the package install state for distribution packages
# Options are 'present' and 'latest'
@ -223,7 +223,7 @@ swift_oslomsg_notify_vhost: /swift
# value at 16 if the swift proxy is in a container and user did not define
# this variable.
swift_proxy_server_workers_max: 16
swift_proxy_server_workers_not_capped: "{{ [(ansible_processor_vcpus//ansible_processor_threads_per_core)|default(1), 1] | max * 2 }}"
swift_proxy_server_workers_not_capped: "{{ [(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2 }}"
swift_proxy_server_workers_capped: "{{ [swift_proxy_server_workers_max, swift_proxy_server_workers_not_capped|int] | min }}"
swift_proxy_server_workers: "{{ (inventory_hostname == physical_host) | ternary(swift_proxy_server_workers_not_capped, swift_proxy_server_workers_capped) }}"

View File

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

View File

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

View File

@ -29,8 +29,8 @@
package:
name: "{{ swift_package_list }}"
state: "{{ swift_package_state }}"
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | 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

View File

@ -49,7 +49,7 @@
dest: "/etc/default/rsync"
line: "RSYNC_ENABLE=true"
regexp: "^RSYNC_ENABLE*"
when: ansible_pkg_mgr =="apt"
when: ansible_facts['pkg_mgr'] =="apt"
notify: "Restart rsync service"
- name: "Setup swift-recon-cron cron job"

View File

@ -1,6 +1,6 @@
# {{ ansible_managed }}
{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %}
{% set _api_threads = ansible_facts['processor_vcpus']|default(2) // 2 %}
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
[DEFAULT]

View File

@ -1,6 +1,6 @@
# {{ ansible_managed }}
{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %}
{% set _api_threads = ansible_facts['processor_vcpus']|default(2) // 2 %}
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
[DEFAULT]

View File

@ -1,6 +1,6 @@
# {{ ansible_managed }}
{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %}
{% set _api_threads = ansible_facts['processor_vcpus']|default(2) // 2 %}
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
[DEFAULT]

View File

@ -1,6 +1,6 @@
# {{ ansible_managed }}
{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %}
{% set _api_threads = ansible_facts['processor_vcpus']|default(2) // 2 %}
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
[DEFAULT]

View File

@ -1,6 +1,6 @@
# {{ ansible_managed }}
{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %}
{% set _api_threads = ansible_facts['processor_vcpus']|default(2) // 2 %}
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
[DEFAULT]

View File

@ -1,6 +1,6 @@
# {{ ansible_managed }}
{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %}
{% set _api_threads = ansible_facts['processor_vcpus']|default(2) // 2 %}
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
[DEFAULT]

View File

@ -1,6 +1,6 @@
# {{ ansible_managed }}
{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %}
{% set _api_threads = ansible_facts['processor_vcpus']|default(2) // 2 %}
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
[DEFAULT]

View File

@ -1,6 +1,6 @@
# {{ ansible_managed }}
{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %}
{% set _api_threads = ansible_facts['processor_vcpus']|default(2) // 2 %}
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
[DEFAULT]

View File

@ -1,6 +1,6 @@
# {{ ansible_managed }}
{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %}
{% set _api_threads = ansible_facts['processor_vcpus']|default(2) // 2 %}
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
[DEFAULT]