Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654 Change-Id: Ia6dac13c7e2206f4a86ef8e21c5b1cd80eb16e0e
This commit is contained in:
parent
5d0ae7e145
commit
b8fc872113
@ -34,11 +34,11 @@ rabbit_system_group_name: rabbitmq
|
||||
rabbitmq_hosts_entries: >-
|
||||
{{ groups[rabbitmq_host_group] | map('extract', hostvars) | list |
|
||||
json_query(
|
||||
"[].{address: rabbitmq_node_address || ansible_host , hostnames: [ansible_hostname, ansible_fqdn] }"
|
||||
"[].{address: rabbitmq_node_address || ansible_host , hostnames: [ansible_facts.hostname, ansible_facts.fqdn] }"
|
||||
)
|
||||
}}
|
||||
|
||||
rabbitmq_primary_cluster_node: "{{ hostvars[groups[rabbitmq_host_group][0]]['ansible_hostname'] }}"
|
||||
rabbitmq_primary_cluster_node: "{{ hostvars[groups[rabbitmq_host_group][0]]['ansible_facts']['hostname'] }}"
|
||||
|
||||
# Upgrading the RabbitMQ package requires shutting down the cluster. This variable makes upgrading
|
||||
# the version an explicit action.
|
||||
@ -110,7 +110,7 @@ rabbitmq_ssl_ca_cert: /etc/rabbitmq/rabbitmq-ca.pem
|
||||
# SSL certificate for RabbitMQ when this playbook runs. You can also change
|
||||
# the subject of the self-signed certificate here if you prefer.
|
||||
rabbitmq_ssl_self_signed_regen: false
|
||||
rabbitmq_ssl_self_signed_subject: "/C=US/ST=Texas/L=San Antonio/O=IT/CN={{ ansible_hostname }}"
|
||||
rabbitmq_ssl_self_signed_subject: "/C=US/ST=Texas/L=San Antonio/O=IT/CN={{ ansible_facts['hostname'] }}"
|
||||
|
||||
# Define user-provided SSL certificates in:
|
||||
# /etc/openstack_deploy/user_variables.yml
|
||||
|
@ -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
|
||||
|
||||
|
@ -36,11 +36,11 @@
|
||||
command: |
|
||||
rabbitmqctl set_cluster_name {{ rabbitmq_cluster_name }}
|
||||
when:
|
||||
- "ansible_hostname == rabbitmq_primary_cluster_node"
|
||||
- "ansible_facts['hostname'] == rabbitmq_primary_cluster_node"
|
||||
- "_cluster_name.stdout != rabbitmq_cluster_name"
|
||||
|
||||
- name: Join cluster on secondary nodes
|
||||
include_tasks: rabbitmq_cluster_join.yml
|
||||
when:
|
||||
- "ansible_hostname != rabbitmq_primary_cluster_node"
|
||||
- "ansible_facts['hostname'] != rabbitmq_primary_cluster_node"
|
||||
- "_cluster_name.stdout != rabbitmq_cluster_name"
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
- include_tasks: rabbitmq_upgrade_check.yml
|
||||
|
||||
- include_tasks: "install_{{ ansible_pkg_mgr }}.yml"
|
||||
- include_tasks: "install_{{ ansible_facts['pkg_mgr'] }}.yml"
|
||||
tags:
|
||||
- rabbitmq-apt-packages
|
||||
- rabbitmq-yum-packages
|
||||
|
@ -79,7 +79,7 @@
|
||||
|
||||
- name: Apply rabbitmq policies
|
||||
community.rabbitmq.rabbitmq_policy:
|
||||
node: "rabbit@{{ ansible_hostname }}"
|
||||
node: "rabbit@{{ ansible_facts['hostname'] }}"
|
||||
name: "{{ item.name }}"
|
||||
pattern: "{{ item.pattern }}"
|
||||
priority: "{{ item.priority | default(0) }}"
|
||||
@ -100,7 +100,7 @@
|
||||
# that the "guest" user is eradicated.
|
||||
- name: Ensure default rabbitmq guest user is removed
|
||||
community.rabbitmq.rabbitmq_user:
|
||||
node: "rabbit@{{ ansible_hostname }}"
|
||||
node: "rabbit@{{ ansible_facts['hostname'] }}"
|
||||
user: guest
|
||||
state: absent
|
||||
when: inventory_hostname == groups[rabbitmq_host_group][0]
|
||||
@ -109,7 +109,7 @@
|
||||
|
||||
- name: Ensure default rabbitmq guest user is removed
|
||||
community.rabbitmq.rabbitmq_user:
|
||||
node: "rabbit@{{ ansible_hostname }}"
|
||||
node: "rabbit@{{ ansible_facts['hostname'] }}"
|
||||
user: guest
|
||||
state: absent
|
||||
when: inventory_hostname != groups[rabbitmq_host_group][0]
|
||||
|
@ -19,7 +19,7 @@
|
||||
state: started
|
||||
enabled: yes
|
||||
when:
|
||||
- ansible_hostname == rabbitmq_primary_cluster_node
|
||||
- ansible_facts['hostname'] == rabbitmq_primary_cluster_node
|
||||
tags:
|
||||
- rabbitmq-server-started
|
||||
- rabbitmq-upgrade
|
||||
@ -31,7 +31,7 @@
|
||||
state: started
|
||||
enabled: yes
|
||||
when:
|
||||
- ansible_hostname != rabbitmq_primary_cluster_node
|
||||
- ansible_facts['hostname'] != rabbitmq_primary_cluster_node
|
||||
tags:
|
||||
- rabbitmq-server-started
|
||||
- rabbitmq-upgrade
|
||||
|
@ -19,7 +19,7 @@
|
||||
state: stopped
|
||||
failed_when: false
|
||||
when:
|
||||
- ansible_hostname != rabbitmq_primary_cluster_node
|
||||
- ansible_facts['hostname'] != rabbitmq_primary_cluster_node
|
||||
tags:
|
||||
- rabbitmq-server-stopped
|
||||
- rabbitmq-upgrade
|
||||
@ -31,7 +31,7 @@
|
||||
state: stopped
|
||||
failed_when: false
|
||||
when:
|
||||
- ansible_hostname == rabbitmq_primary_cluster_node
|
||||
- ansible_facts['hostname'] == rabbitmq_primary_cluster_node
|
||||
tags:
|
||||
- rabbitmq-server-stopped
|
||||
- rabbitmq-upgrade
|
||||
|
@ -23,7 +23,7 @@
|
||||
register: installed_rabbitmq_deb
|
||||
when:
|
||||
- not rabbitmq_upgrade | bool
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
- ansible_facts['pkg_mgr'] == 'apt'
|
||||
tags:
|
||||
- rabbitmq-package-deb
|
||||
- rabbitmq-apt-packages
|
||||
@ -41,7 +41,7 @@
|
||||
register: installed_rabbitmq_rpm
|
||||
when:
|
||||
- not rabbitmq_upgrade | bool
|
||||
- ansible_pkg_mgr in ['yum', 'dnf', 'zypper']
|
||||
- ansible_facts['pkg_mgr'] in ['yum', 'dnf', 'zypper']
|
||||
tags:
|
||||
- rabbitmq-package-rpm
|
||||
- rabbitmq-yum-packages
|
||||
|
@ -1,7 +1,7 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
# Set ERLANG VM parameters
|
||||
NODENAME=rabbit@{{ ansible_hostname }}
|
||||
NODENAME=rabbit@{{ ansible_facts['hostname'] }}
|
||||
RABBITMQ_IO_THREAD_POOL_SIZE={{ rabbitmq_async_threads }}
|
||||
RABBITMQ_SERVER_ERL_ARGS="+P {{ rabbitmq_process_limit }}"
|
||||
|
||||
|
@ -20,22 +20,22 @@ _rabbitmq_gpg_keys:
|
||||
- file: gpg/4D206F89
|
||||
- file: gpg/A14F4FCA
|
||||
|
||||
_rabbitmq_repo_url: "https://packagecloud.io/rabbitmq/rabbitmq-server/{{ ansible_distribution | lower }}"
|
||||
_rabbitmq_repo_url: "https://packagecloud.io/rabbitmq/rabbitmq-server/{{ ansible_facts['distribution'] | lower }}"
|
||||
_rabbitmq_repo:
|
||||
repo: "deb {{ rabbitmq_repo_url }} {{ ansible_distribution_release | lower }} main"
|
||||
repo: "deb {{ rabbitmq_repo_url }} {{ ansible_facts['distribution_release'] | lower }} main"
|
||||
state: "present"
|
||||
filename: "RabbitMQ"
|
||||
|
||||
_rabbitmq_erlang_repo_url: "https://packages.erlang-solutions.com/{{ ansible_distribution | lower }}"
|
||||
_rabbitmq_erlang_repo_url: "https://packages.erlang-solutions.com/{{ ansible_facts['distribution'] | lower }}"
|
||||
_rabbitmq_erlang_repo:
|
||||
repo: "deb {{ rabbitmq_erlang_repo_url }} {{ ansible_distribution_release | lower }} contrib"
|
||||
repo: "deb {{ rabbitmq_erlang_repo_url }} {{ ansible_facts['distribution_release'] | lower }} contrib"
|
||||
state: "present"
|
||||
filename: els_erlang
|
||||
|
||||
_rabbitmq_erlang_version_spec: "{{ (rabbitmq_install_method == 'external_repo') | ternary('1:22.3-1', '1:22.*') }}"
|
||||
|
||||
_rabbitmq_distro_dependencies:
|
||||
- "{{ (ansible_architecture == 'aarch64') | ternary('erlang-base', 'erlang-base-hipe') }}"
|
||||
- "{{ (ansible_facts['architecture'] == 'aarch64') | ternary('erlang-base', 'erlang-base-hipe') }}"
|
||||
- erlang-diameter
|
||||
- erlang-eldap
|
||||
- erlang-nox
|
||||
|
@ -16,14 +16,14 @@
|
||||
_rabbitmq_install_method: external_repo
|
||||
_rabbitmq_package_version: 3.8.9-1
|
||||
|
||||
_rabbitmq_repo_url: "https://packagecloud.io/rabbitmq/rabbitmq-server/el/{{ ansible_distribution_major_version }}/$basearch"
|
||||
_rabbitmq_repo_url: "https://packagecloud.io/rabbitmq/rabbitmq-server/el/{{ ansible_facts['distribution_major_version'] }}/$basearch"
|
||||
_rabbitmq_repo:
|
||||
name: rabbitmq_rabbitmq-server
|
||||
description: "RabbitMQ Server Rolling Repository"
|
||||
baseurl: "{{ rabbitmq_repo_url }}"
|
||||
filename: RabbitMQ
|
||||
|
||||
_rabbitmq_erlang_repo_url: "https://packagecloud.io/rabbitmq/erlang/el/{{ ansible_distribution_major_version }}/$basearch"
|
||||
_rabbitmq_erlang_repo_url: "https://packagecloud.io/rabbitmq/erlang/el/{{ ansible_facts['distribution_major_version'] }}/$basearch"
|
||||
_rabbitmq_erlang_repo:
|
||||
name: rabbitmq_els-erlang
|
||||
description: "RabbitMQ Erlang Packages from Bintray"
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
# NOTE(jrosser) this is set to distro as there is no rabbitmq package currently for focal at packagecloud
|
||||
_rabbitmq_install_method: distro
|
||||
_rabbitmq_package_url: "https://packagecloud.io/rabbitmq/rabbitmq-server/packages/{{ ansible_distribution | lower }}/{{ ansible_distribution_release | lower }}/rabbitmq-server_3.8.2-1_all.deb/download.deb"
|
||||
_rabbitmq_package_url: "https://packagecloud.io/rabbitmq/rabbitmq-server/packages/{{ ansible_facts['distribution'] | lower }}/{{ ansible_facts['distribution_release'] | lower }}/rabbitmq-server_3.8.2-1_all.deb/download.deb"
|
||||
_rabbitmq_package_version: "{{ _rabbitmq_package_url.split('/')[-2].split('_')[1] }}"
|
||||
_rabbitmq_release_version: "{{ _rabbitmq_package_version.split('-')[0] }}"
|
||||
_rabbitmq_package_sha256: "aebdb80be49fe3adbf99c859006d8a503f531be79a0cd0712a30341e4c72054f"
|
||||
@ -25,16 +25,16 @@ _rabbitmq_gpg_keys:
|
||||
- file: gpg/4D206F89
|
||||
- file: gpg/A14F4FCA
|
||||
|
||||
_rabbitmq_repo_url: "https://packagecloud.io/rabbitmq/rabbitmq-server/{{ ansible_distribution | lower }}"
|
||||
_rabbitmq_repo_url: "https://packagecloud.io/rabbitmq/rabbitmq-server/{{ ansible_facts['distribution'] | lower }}"
|
||||
_rabbitmq_repo:
|
||||
repo: "deb {{ rabbitmq_repo_url }} {{ ansible_distribution_release | lower }} main"
|
||||
repo: "deb {{ rabbitmq_repo_url }} {{ ansible_facts['distribution_release'] | lower }} main"
|
||||
# NOTE(jrosser) this is set to absent as there is no rabbitmq package currently for focal at packagecloud
|
||||
state: "absent"
|
||||
filename: "RabbitMQ"
|
||||
|
||||
_rabbitmq_erlang_repo_url: "https://packages.erlang-solutions.com/{{ ansible_distribution | lower }}"
|
||||
_rabbitmq_erlang_repo_url: "https://packages.erlang-solutions.com/{{ ansible_facts['distribution'] | lower }}"
|
||||
_rabbitmq_erlang_repo:
|
||||
repo: "deb {{ rabbitmq_erlang_repo_url }} {{ ansible_distribution_release | lower }} contrib"
|
||||
repo: "deb {{ rabbitmq_erlang_repo_url }} {{ ansible_facts['distribution_release'] | lower }} contrib"
|
||||
# NOTE(jrosser) this is set to absent as there is no erlang package currently for focal at packagecloud
|
||||
state: "absent"
|
||||
filename: els_erlang
|
||||
@ -42,7 +42,7 @@ _rabbitmq_erlang_repo:
|
||||
_rabbitmq_erlang_version_spec: "1:22.*"
|
||||
|
||||
rabbitmq_dependencies:
|
||||
- "{{ (ansible_architecture == 'aarch64') | ternary('erlang-base', 'erlang-base-hipe') }}"
|
||||
- "{{ (ansible_facts['architecture'] == 'aarch64') | ternary('erlang-base', 'erlang-base-hipe') }}"
|
||||
- erlang-diameter
|
||||
- erlang-eldap
|
||||
- erlang-nox
|
||||
|
Loading…
Reference in New Issue
Block a user