Use ansible_facts[] instead of fact variables

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

Change-Id: If731b98c03bae2b38eb494c060699abea3cda9e0
This commit is contained in:
Jonathan Rosser 2021-03-15 18:12:49 +00:00
parent d3c97a45d8
commit e5920f628e
6 changed files with 15 additions and 15 deletions

View File

@ -25,7 +25,7 @@ ironic_venv_python_executable: "{{ openstack_venv_python_executable | default('p
# for the service setup. The host must already have # for the service setup. The host must already have
# clouds.yaml properly configured. # clouds.yaml properly configured.
ironic_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}" ironic_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}"
ironic_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((ironic_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}" ironic_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((ironic_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
# Comma separated list of Glance API servers # Comma separated list of Glance API servers
ironic_glance_api_servers: "{{ (glance_service_internalurl | default('http://localhost')) | urlsplit('scheme') ~ '://' ~ (glance_service_internalurl | default('http://localhost')) | urlsplit('netloc') }}" ironic_glance_api_servers: "{{ (glance_service_internalurl | default('http://localhost')) | urlsplit('scheme') ~ '://' ~ (glance_service_internalurl | default('http://localhost')) | urlsplit('netloc') }}"
@ -141,7 +141,7 @@ ironic_erase_devices_priority: 10
# Database # Database
ironic_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}" ironic_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
ironic_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((ironic_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}" ironic_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((ironic_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
ironic_galera_address: "{{ galera_address | default('127.0.0.1') }}" ironic_galera_address: "{{ galera_address | default('127.0.0.1') }}"
ironic_galera_user: ironic ironic_galera_user: ironic
ironic_galera_database: ironic ironic_galera_database: ironic
@ -246,7 +246,7 @@ ironic_service_user_name: "ironic"
# WSGI settings # WSGI settings
ironic_wsgi_threads: 1 ironic_wsgi_threads: 1
ironic_wsgi_processes_max: 16 ironic_wsgi_processes_max: 16
ironic_wsgi_processes: "{{ [[(ansible_processor_vcpus//ansible_processor_threads_per_core)|default(1), 1] | max * 2, ironic_wsgi_processes_max] | min }}" ironic_wsgi_processes: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, ironic_wsgi_processes_max] | min }}"
ironic_uwsgi_bind_address: "{{ openstack_service_bind_address | default('0.0.0.0') }}" ironic_uwsgi_bind_address: "{{ openstack_service_bind_address | default('0.0.0.0') }}"
### OpenStack Services to integrate with ### OpenStack Services to integrate with
@ -308,7 +308,7 @@ ironic_inspector_service_domain_id: default
# Database # Database
ironic_inspector_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}" ironic_inspector_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
ironic_inspector_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((ironic_inspector_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}" ironic_inspector_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((ironic_inspector_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
ironic_inspector_galera_address: "{{ galera_address | default('127.0.0.1') }}" ironic_inspector_galera_address: "{{ galera_address | default('127.0.0.1') }}"
ironic_inspector_galera_user: ironic-inspector ironic_inspector_galera_user: ironic-inspector
ironic_inspector_galera_database: ironic_inspector ironic_inspector_galera_database: ironic_inspector

View File

@ -48,7 +48,7 @@
name: "nginx" name: "nginx"
enabled: yes enabled: yes
state: restarted state: restarted
daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}" daemon_reload: yes
register: _restart register: _restart
until: _restart is success until: _restart is success
retries: 5 retries: 5

View File

@ -37,4 +37,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

@ -34,7 +34,7 @@
src: "tftpd-hpa.j2" src: "tftpd-hpa.j2"
dest: "/etc/default/tftpd-hpa" dest: "/etc/default/tftpd-hpa"
when: when:
- ansible_os_family == 'Debian' - ansible_facts['os_family'] == 'Debian'
notify: notify:
- Restart tftpd - Restart tftpd
@ -97,7 +97,7 @@
path: "/etc/nginx/sites-enabled/ironic-ipxe.conf" path: "/etc/nginx/sites-enabled/ironic-ipxe.conf"
state: link state: link
when: when:
- ansible_os_family == "Debian" - ansible_facts['os_family'] == "Debian"
- "ironic_ipxe_enabled | bool" - "ironic_ipxe_enabled | bool"
notify: notify:
- Restart web server - Restart web server

View File

@ -25,7 +25,7 @@
path: /etc/default/dnsmasq path: /etc/default/dnsmasq
state: present state: present
line: 'DNSMASQ_EXCEPT=lo' line: 'DNSMASQ_EXCEPT=lo'
when: ansible_os_family == 'Debian' when: ansible_facts['os_family'] == 'Debian'
notify: notify:
- Restart dnsmasq - Restart dnsmasq
@ -36,7 +36,7 @@
regexp: '^#IGNORE_RESOLVCONF=.*' regexp: '^#IGNORE_RESOLVCONF=.*'
line: 'IGNORE_RESOLVCONF=yes' line: 'IGNORE_RESOLVCONF=yes'
backrefs: yes backrefs: yes
when: ansible_os_family == 'Debian' when: ansible_facts['os_family'] == 'Debian'
notify: notify:
- Restart dnsmasq - Restart dnsmasq

View File

@ -16,11 +16,11 @@
- 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 }}.yml" - "{{ ansible_facts['os_family'] | lower }}.yml"
tags: tags:
- always - always