Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654 Change-Id: I3e48000a4685d4df46cd60113ce4c0c02b63dc0c
This commit is contained in:
parent
46c4b8e104
commit
aab7090e4d
@ -18,14 +18,14 @@ debug: False
|
||||
|
||||
## Cap the maximum number of threads / workers when a user value is unspecified.
|
||||
repo_nginx_threads_max: 16
|
||||
repo_nginx_threads: "{{ [[ansible_processor_vcpus|default(2) // 2, 1] | max, repo_nginx_threads_max] | min }}"
|
||||
repo_nginx_threads: "{{ [[ansible_facts['processor_vcpus']|default(2) // 2, 1] | max, repo_nginx_threads_max] | min }}"
|
||||
|
||||
## APT Cache Options
|
||||
cache_timeout: 600
|
||||
|
||||
## Centos EPEL repository options
|
||||
repo_centos_epel_mirror: "{{ centos_epel_mirror | default('http://download.fedoraproject.org/pub/epel') }}"
|
||||
repo_centos_epel_key: "{{ centos_epel_key | default('http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-' ~ ansible_distribution_major_version) }}"
|
||||
repo_centos_epel_key: "{{ centos_epel_key | default('http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-' ~ ansible_facts['distribution_major_version']) }}"
|
||||
|
||||
## Centos NGINX repository options
|
||||
repo_centos_nginx_mirror: "{{ centos_nginx_mirror | default('http://nginx.org/packages/centos/$releasever/$basearch') }}"
|
||||
|
@ -18,7 +18,7 @@
|
||||
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
|
||||
@ -29,7 +29,7 @@
|
||||
name: "{{ rsyncd_service_name }}"
|
||||
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
|
||||
@ -40,7 +40,7 @@
|
||||
name: "lsyncd"
|
||||
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
|
||||
|
@ -37,4 +37,4 @@ galaxy_info:
|
||||
dependencies:
|
||||
- role: apt_package_pinning
|
||||
when:
|
||||
- ansible_pkg_mgr == 'apt'
|
||||
- ansible_facts['pkg_mgr'] == 'apt'
|
||||
|
@ -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
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
key: "{{ repo_centos_epel_key }}"
|
||||
state: present
|
||||
when:
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
- ansible_facts['pkg_mgr'] in ['yum', 'dnf']
|
||||
register: _add_yum_keys
|
||||
until: _add_yum_keys is success
|
||||
retries: 5
|
||||
@ -34,7 +34,7 @@
|
||||
state: present
|
||||
includepkgs: 'lsyncd'
|
||||
when:
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
- ansible_facts['pkg_mgr'] in ['yum', 'dnf']
|
||||
register: install_epel_repo
|
||||
until: install_epel_repo is success
|
||||
retries: 5
|
||||
@ -47,7 +47,7 @@
|
||||
baseurl: "{{ repo_centos_nginx_mirror }}"
|
||||
gpgkey: "{{ repo_centos_nginx_key }}"
|
||||
when:
|
||||
- ansible_pkg_mgr in ['yum', 'dnf']
|
||||
- ansible_facts['pkg_mgr'] in ['yum', 'dnf']
|
||||
register: add_nginx_repo
|
||||
until: add_nginx_repo is success
|
||||
retries: 5
|
||||
@ -57,8 +57,8 @@
|
||||
package:
|
||||
name: "{{ repo_server_distro_packages | reject('equalto', '') | list }}"
|
||||
state: "{{ repo_server_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
|
||||
|
@ -1,5 +1,5 @@
|
||||
{% if ansible_os_family == 'Debian' %}
|
||||
{% if ansible_facts['os_family'] == 'Debian' %}
|
||||
DAEMON_ARGS="$DAEMON_ARGS -insist"
|
||||
{% elif ansible_os_family == 'RedHat' %}
|
||||
{% elif ansible_facts['os_family'] == 'RedHat' %}
|
||||
LSYNCD_OPTIONS="{{ repo_lsyncd_config_file }}"
|
||||
{% endif %}
|
||||
|
@ -13,7 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
repo_centos_epel_base: "{{ ansible_distribution_major_version ~ '/' ~ ansible_architecture }}"
|
||||
repo_centos_epel_base: "{{ ansible_facts['distribution_major_version'] ~ '/' ~ ansible_facts['architecture'] }}"
|
||||
|
||||
systemd_utils_prefix: "/lib/systemd"
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
repo_centos_epel_base: "{{ ansible_distribution_major_version ~ '/Everything/' ~ ansible_architecture }}"
|
||||
repo_centos_epel_base: "{{ ansible_facts['distribution_major_version'] ~ '/Everything/' ~ ansible_facts['architecture'] }}"
|
||||
|
||||
systemd_utils_prefix: "/lib/systemd"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user