Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654 Change-Id: I8721b4fa97b41fb0c92f9eb99b61d31634e9aac6
This commit is contained in:
parent
37a54e0788
commit
489c169874
@ -20,7 +20,7 @@ debug: False
|
||||
# for the service setup. The host must already have
|
||||
# clouds.yaml properly configured.
|
||||
keystone_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}"
|
||||
keystone_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((keystone_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
|
||||
keystone_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((keystone_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'
|
||||
@ -97,7 +97,7 @@ keystone_bind_address: "{{ openstack_service_bind_address | default('0.0.0.0') }
|
||||
|
||||
## Database info
|
||||
keystone_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
|
||||
keystone_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((keystone_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
|
||||
keystone_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((keystone_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
|
||||
keystone_galera_address: "{{ galera_address | default('127.0.0.1') }}"
|
||||
keystone_galera_user: keystone
|
||||
keystone_galera_database: keystone
|
||||
@ -235,7 +235,7 @@ keystone_nginx_extra_conf:
|
||||
keystone_wsgi_threads: 1
|
||||
## Cap the maximun number of processes when a user value is unspecified.
|
||||
keystone_wsgi_processes_max: 16
|
||||
keystone_wsgi_processes: "{{ [[ansible_processor_vcpus|default(1), 1] | max * 2, keystone_wsgi_processes_max] | min }}"
|
||||
keystone_wsgi_processes: "{{ [[ansible_facts['processor_vcpus']|default(1), 1] | max * 2, keystone_wsgi_processes_max] | min }}"
|
||||
keystone_uwsgi_bind_address: "{{ openstack_service_bind_address | default('0.0.0.0') }}"
|
||||
|
||||
keystone_uwsgi_ports:
|
||||
|
@ -18,7 +18,7 @@
|
||||
name: "{{ (keystone_web_server == 'apache') | ternary(keystone_system_service_name, 'nginx') }}"
|
||||
enabled: yes
|
||||
state: restarted
|
||||
daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}"
|
||||
daemon_reload: "{{ (ansible_facts['service_mgr'] == 'systemd') | ternary('yes', omit) }}"
|
||||
register: _restart
|
||||
until: _restart is success
|
||||
retries: 5
|
||||
@ -45,7 +45,7 @@
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
state: "stopped"
|
||||
daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}"
|
||||
daemon_reload: "{{ (ansible_facts['service_mgr'] == 'systemd') | ternary('yes', omit) }}"
|
||||
register: _stop
|
||||
until: _stop is success
|
||||
retries: 5
|
||||
@ -60,7 +60,7 @@
|
||||
name: "{{ item }}"
|
||||
enabled: yes
|
||||
state: "started"
|
||||
daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}"
|
||||
daemon_reload: "{{ (ansible_facts['service_mgr'] == 'systemd') | ternary('yes', omit) }}"
|
||||
register: _start
|
||||
until: _start is success
|
||||
retries: 5
|
||||
@ -89,7 +89,7 @@
|
||||
name: "shibd"
|
||||
enabled: yes
|
||||
state: "restarted"
|
||||
daemon_reload: "{{ (ansible_service_mgr == 'systemd') | ternary('yes', omit) }}"
|
||||
daemon_reload: "{{ (ansible_facts['service_mgr'] == 'systemd') | ternary('yes', omit) }}"
|
||||
register: _restart
|
||||
until: _restart is success
|
||||
retries: 5
|
||||
@ -101,7 +101,7 @@
|
||||
debian: nc -q 1 $(awk '/^\-l/ {print $2}' "/etc/memcached.conf" | awk -F, '{print $1}') $(awk '/^\-p/ {print $2}' "/etc/memcached.conf")
|
||||
redhat: nc $(awk -F '-l' '/^OPTIONS/ {print $2}' "/etc/sysconfig/memcached" | awk -F ',' '{gsub(/"/, "", $1); print $1}' | awk -F '-' '{print $1}') 11211
|
||||
suse: nc -w 1 $(awk -F '-l' '/^MEMCACHED_PARAMS/ {print $2}' "/etc/sysconfig/memcached" | awk -F ',' '{gsub(/"/, "", $1); print $1}' | awk -F '-' '{print $1}') 11211
|
||||
shell: "echo 'flush_all' | {{ nc_command.get(ansible_os_family | lower) }}"
|
||||
shell: "echo 'flush_all' | {{ nc_command.get(ansible_facts['os_family'] | lower) }}"
|
||||
delegate_to: "{{ item }}"
|
||||
with_items: "{{ groups.memcached_all }}"
|
||||
listen: flush cache
|
||||
|
@ -42,4 +42,4 @@ galaxy_info:
|
||||
dependencies:
|
||||
- role: apt_package_pinning
|
||||
when:
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
- ansible_facts['pkg_mgr'] == 'apt'
|
||||
|
@ -51,7 +51,7 @@
|
||||
state: "{{ item.state }}"
|
||||
with_items: "{{ keystone_apache_modules }}"
|
||||
when:
|
||||
- ansible_pkg_mgr in ['apt', 'zypper']
|
||||
- ansible_facts['pkg_mgr'] in ['apt', 'zypper']
|
||||
notify:
|
||||
- Manage LB
|
||||
- Restart web server
|
||||
@ -64,7 +64,7 @@
|
||||
line: 'LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so'
|
||||
state: "present"
|
||||
when:
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
- ansible_facts['pkg_mgr'] in ['yum', 'dnf']
|
||||
notify:
|
||||
- Manage LB
|
||||
- Restart web server
|
||||
@ -93,7 +93,7 @@
|
||||
- name: Ensure Apache ServerName
|
||||
lineinfile:
|
||||
dest: "{{ keystone_apache_conf }}"
|
||||
line: "ServerName {{ ansible_hostname }}"
|
||||
line: "ServerName {{ ansible_facts['hostname'] }}"
|
||||
notify:
|
||||
- Manage LB
|
||||
- Restart web server
|
||||
|
@ -24,7 +24,7 @@
|
||||
- { path: "/var/lock/keystone", mode: "2755" }
|
||||
- { path: "/var/log/httpd", mode: "2755" }
|
||||
when:
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
- ansible_facts['pkg_mgr'] in ['yum', 'dnf']
|
||||
|
||||
- name: Create system links
|
||||
file:
|
||||
@ -34,7 +34,7 @@
|
||||
with_items:
|
||||
- { src: "/var/log/httpd", dest: "/var/log/apache2" }
|
||||
when:
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
- ansible_facts['pkg_mgr'] in ['yum', 'dnf']
|
||||
|
||||
- name: Add shibboleth repo
|
||||
yum_repository:
|
||||
@ -44,7 +44,7 @@
|
||||
gpgkey: "{{ keystone_centos_shibboleth_key }}"
|
||||
gpgcheck: yes
|
||||
when:
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
- ansible_facts['pkg_mgr'] in ['yum', 'dnf']
|
||||
- keystone_sp != {}
|
||||
|
||||
- name: Add NGINX repository keys
|
||||
@ -52,7 +52,7 @@
|
||||
key: "{{ keystone_centos_nginx_key }}"
|
||||
state: present
|
||||
when:
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
- ansible_facts['pkg_mgr'] in ['yum', 'dnf']
|
||||
- keystone_web_server == 'nginx'
|
||||
register: add_nginx_key
|
||||
until: add_nginx_key is success
|
||||
@ -65,7 +65,7 @@
|
||||
description: 'nginx repo'
|
||||
baseurl: "{{ keystone_centos_nginx_mirror }}"
|
||||
when:
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
- ansible_facts['pkg_mgr'] in ['yum', 'dnf']
|
||||
- keystone_web_server == 'nginx'
|
||||
register: add_nginx_repo
|
||||
until: add_nginx_repo is success
|
||||
@ -86,10 +86,10 @@
|
||||
package:
|
||||
name: "{{ (keystone_web_server == 'nginx') | ternary(keystone_apache_distro_packages, keystone_nginx_distro_packages) }}"
|
||||
state: absent
|
||||
autoremove: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
|
||||
newuse: "{{ (ansible_pkg_mgr == 'portage') | ternary('yes', omit) }}"
|
||||
changed_use: "{{ (ansible_pkg_mgr == 'portage') | ternary('yes', omit) }}"
|
||||
noreplace: "{{ (ansible_pkg_mgr == 'portage') | ternary('yes', omit) }}"
|
||||
autoremove: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
|
||||
newuse: "{{ (ansible_facts['pkg_mgr'] == 'portage') | ternary('yes', omit) }}"
|
||||
changed_use: "{{ (ansible_facts['pkg_mgr'] == 'portage') | ternary('yes', omit) }}"
|
||||
noreplace: "{{ (ansible_facts['pkg_mgr'] == 'portage') | ternary('yes', omit) }}"
|
||||
when: "(is_metal is undefined) or
|
||||
not (is_metal | bool)"
|
||||
|
||||
@ -97,11 +97,11 @@
|
||||
package:
|
||||
name: "{{ keystone_package_list }}"
|
||||
state: "{{ keystone_package_state }}"
|
||||
update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}"
|
||||
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
|
||||
newuse: "{{ (ansible_pkg_mgr == 'portage') | ternary('yes', omit) }}"
|
||||
changed_use: "{{ (ansible_pkg_mgr == 'portage') | ternary('yes', omit) }}"
|
||||
noreplace: "{{ (ansible_pkg_mgr == 'portage') | ternary('yes', 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) }}"
|
||||
newuse: "{{ (ansible_facts['pkg_mgr'] == 'portage') | ternary('yes', omit) }}"
|
||||
changed_use: "{{ (ansible_facts['pkg_mgr'] == 'portage') | ternary('yes', omit) }}"
|
||||
noreplace: "{{ (ansible_facts['pkg_mgr'] == 'portage') | ternary('yes', omit) }}"
|
||||
register: install_packages
|
||||
until: install_packages is success
|
||||
retries: 5
|
||||
|
@ -67,7 +67,7 @@
|
||||
group: root
|
||||
owner: root
|
||||
when:
|
||||
- ansible_pkg_mgr == 'portage'
|
||||
- ansible_facts['pkg_mgr'] == 'portage'
|
||||
notify:
|
||||
- Manage LB
|
||||
- Restart web server
|
||||
@ -88,7 +88,7 @@
|
||||
path: "/etc/nginx/sites-enabled/{{ item }}.conf"
|
||||
state: link
|
||||
with_items: "{{ keystone_services.keys() | list }}"
|
||||
when: ansible_os_family == "Debian"
|
||||
when: ansible_facts['os_family'] == "Debian"
|
||||
notify:
|
||||
- Manage LB
|
||||
- Restart web server
|
||||
|
@ -34,12 +34,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
|
||||
|
||||
|
@ -56,7 +56,7 @@ keystone_sp_distro_packages:
|
||||
'shibboleth-sp') }}"
|
||||
|
||||
keystone_developer_mode_distro_packages:
|
||||
- "{{ (ansible_distribution_version is version ('42', '>=')) | ternary('patterns-openSUSE-devel_basis', 'patterns-devel-base-devel_basis') }}"
|
||||
- "{{ (ansible_facts['distribution_version'] is version ('42', '>=')) | ternary('patterns-openSUSE-devel_basis', 'patterns-devel-base-devel_basis') }}"
|
||||
|
||||
keystone_oslomsg_amqp1_distro_packages:
|
||||
- cyrus-sasl
|
||||
|
Loading…
x
Reference in New Issue
Block a user