diff --git a/defaults/main.yml b/defaults/main.yml index 1760b707..92d30ff1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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) }}" diff --git a/meta/main.yml b/meta/main.yml index 35a2a0a5..d0d2798b 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -39,4 +39,4 @@ galaxy_info: dependencies: - role: apt_package_pinning when: - - ansible_pkg_mgr == 'apt' + - ansible_facts['pkg_mgr'] == 'apt' diff --git a/tasks/main.yml b/tasks/main.yml index 4b861c70..433ce3b9 100644 --- a/tasks/main.yml +++ b/tasks/main.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 diff --git a/tasks/swift_install.yml b/tasks/swift_install.yml index a3c4398e..c24d6e79 100644 --- a/tasks/swift_install.yml +++ b/tasks/swift_install.yml @@ -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 diff --git a/tasks/swift_storage_hosts_setup.yml b/tasks/swift_storage_hosts_setup.yml index f0fa4acd..aa7f86bb 100644 --- a/tasks/swift_storage_hosts_setup.yml +++ b/tasks/swift_storage_hosts_setup.yml @@ -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" diff --git a/templates/account-server-2.conf.j2 b/templates/account-server-2.conf.j2 index 5303bd48..8abbdb16 100644 --- a/templates/account-server-2.conf.j2 +++ b/templates/account-server-2.conf.j2 @@ -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] diff --git a/templates/account-server-replicator.conf.j2 b/templates/account-server-replicator.conf.j2 index 117f2b0c..6b65fb56 100644 --- a/templates/account-server-replicator.conf.j2 +++ b/templates/account-server-replicator.conf.j2 @@ -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] diff --git a/templates/account-server.conf.j2 b/templates/account-server.conf.j2 index 4f182d12..ff099a79 100644 --- a/templates/account-server.conf.j2 +++ b/templates/account-server.conf.j2 @@ -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] diff --git a/templates/container-server-2.conf.j2 b/templates/container-server-2.conf.j2 index c1fcc692..a4be0e24 100644 --- a/templates/container-server-2.conf.j2 +++ b/templates/container-server-2.conf.j2 @@ -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] diff --git a/templates/container-server-replicator.conf.j2 b/templates/container-server-replicator.conf.j2 index 91dd4cae..cf6fb491 100644 --- a/templates/container-server-replicator.conf.j2 +++ b/templates/container-server-replicator.conf.j2 @@ -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] diff --git a/templates/container-server.conf.j2 b/templates/container-server.conf.j2 index 8a8fbbdc..9f4faa8e 100644 --- a/templates/container-server.conf.j2 +++ b/templates/container-server.conf.j2 @@ -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] diff --git a/templates/object-server-2.conf.j2 b/templates/object-server-2.conf.j2 index 13a18d48..4ad31ef6 100644 --- a/templates/object-server-2.conf.j2 +++ b/templates/object-server-2.conf.j2 @@ -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] diff --git a/templates/object-server-replicator.conf.j2 b/templates/object-server-replicator.conf.j2 index cbf68dc4..239b3cca 100644 --- a/templates/object-server-replicator.conf.j2 +++ b/templates/object-server-replicator.conf.j2 @@ -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] diff --git a/templates/object-server.conf.j2 b/templates/object-server.conf.j2 index 5c60a42a..2aadfc45 100644 --- a/templates/object-server.conf.j2 +++ b/templates/object-server.conf.j2 @@ -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]