diff --git a/handlers/main.yml b/handlers/main.yml index 57fd9db0..57352bba 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Restart swift services - service: + ansible.builtin.service: name: "{{ item.service_name }}" enabled: true state: "restarted" @@ -26,7 +26,7 @@ - "cert installed" - name: Restart rsync service - service: + ansible.builtin.service: name: "{{ swift_rsync_service_name }}" state: "restarted" enabled: "yes" diff --git a/tasks/main.yml b/tasks/main.yml index b374a2d4..4cb9c6b2 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Gather variables for each operating system - include_vars: "{{ lookup('first_found', params) }}" + ansible.builtin.include_vars: "{{ lookup('first_found', params) }}" vars: params: files: @@ -29,7 +29,7 @@ - always - name: Fail if service was deployed using a different installation method - fail: + ansible.builtin.fail: msg: "Switching installation methods for OpenStack services is not supported" when: - ansible_local is defined @@ -39,20 +39,20 @@ - ansible_local.openstack_ansible.swift.install_method != swift_install_method - name: Gather variables for installation method - include_vars: "{{ swift_install_method }}_install.yml" + ansible.builtin.include_vars: "{{ swift_install_method }}_install.yml" tags: - always # Check the swift_hash_path_* variables haven't changed - name: Importing swift_check_hashes tasks - import_tasks: swift_check_hashes.yml + ansible.builtin.import_tasks: swift_check_hashes.yml when: - "not swift_force_change_hashes | bool" tags: - swift-config - name: Importing swift_pre_install tasks - import_tasks: swift_pre_install.yml + ansible.builtin.import_tasks: swift_pre_install.yml when: - "swift_do_setup | bool" - "'swift_all' in group_names" @@ -60,7 +60,7 @@ - swift-install - name: Importing swift_install tasks - import_tasks: swift_install.yml + ansible.builtin.import_tasks: swift_install.yml when: - "swift_do_setup | bool" - "'swift_all' in group_names" @@ -68,7 +68,7 @@ - swift-install - name: Importing swift_post_install tasks - import_tasks: swift_post_install.yml + ansible.builtin.import_tasks: swift_post_install.yml when: - "swift_do_setup | bool" - "'swift_all' in group_names" @@ -77,14 +77,14 @@ - post-install - name: Importing swift_calculate_addresses tasks - import_tasks: swift_calculate_addresses.yml + ansible.builtin.import_tasks: swift_calculate_addresses.yml when: - "'swift_hosts' in group_names" tags: - always - name: Importing swift_storage_hosts tasks - import_tasks: swift_storage_hosts.yml + ansible.builtin.import_tasks: swift_storage_hosts.yml when: - "swift_do_setup | bool" - "'swift_hosts' in group_names" @@ -92,7 +92,7 @@ - swift-config - name: Importing swift_proxy_hosts tasks - import_tasks: swift_proxy_hosts.yml + ansible.builtin.import_tasks: swift_proxy_hosts.yml when: - "swift_do_setup | bool" - "'swift_proxy' in group_names" @@ -100,14 +100,14 @@ - swift-config - name: Importing swift_key_setup tasks - import_tasks: swift_key_setup.yml + ansible.builtin.import_tasks: swift_key_setup.yml when: - "swift_do_sync | bool" tags: - swift-config - name: Importing swift_rings tasks - import_tasks: swift_rings.yml + ansible.builtin.import_tasks: swift_rings.yml when: - "swift_do_sync | bool" tags: @@ -115,7 +115,7 @@ - swift-rings - name: Run the systemd service role - import_role: + ansible.builtin.import_role: name: systemd_service vars: systemd_user_name: "{{ swift_system_user_name }}" @@ -148,7 +148,7 @@ - systemd-service - name: Including osa.mq_setup role - include_role: + ansible.builtin.include_role: name: openstack.osa.mq_setup apply: tags: @@ -168,7 +168,7 @@ - always - name: Including osa.service_setup roled - include_role: + ansible.builtin.include_role: name: openstack.osa.service_setup apply: tags: @@ -214,4 +214,4 @@ - always - name: Flush handlers - meta: flush_handlers + ansible.builtin.meta: flush_handlers diff --git a/tasks/swift_calculate_addresses.yml b/tasks/swift_calculate_addresses.yml index 729b71aa..ce78666a 100644 --- a/tasks/swift_calculate_addresses.yml +++ b/tasks/swift_calculate_addresses.yml @@ -15,7 +15,7 @@ # Set swift_storage_address fact so it is consumable in hostvars (for ring.contents template) - name: Set swift_storage_address fact if defined - set_fact: + ansible.builtin.set_fact: swift_storage_address: "{{ swift_storage_address }}" when: - swift_storage_address is defined @@ -24,7 +24,7 @@ # swift_vars.storage_ip always takes precedence - name: Get swift_vars.storage_ip if defined - set_fact: + ansible.builtin.set_fact: swift_storage_address: "{{ swift_vars.storage_ip }}" when: - swift_vars.storage_ip is defined @@ -33,7 +33,7 @@ # Get the swift storage bridge - name: Get swift storage bridge - set_fact: + ansible.builtin.set_fact: swift_storage_bridge: "{{ swift.storage_network | replace('-', '_') }}" when: - swift.storage_network is defined @@ -42,7 +42,7 @@ - always - name: Gather facts for storage_bridge - setup: + ansible.builtin.setup: filter: "{{ swift_storage_bridge }}" when: - swift_storage_bridge is defined @@ -50,7 +50,7 @@ - swift_storage_address is not defined - name: Swift storage address not found - fail: + ansible.builtin.fail: msg: "{{ swift.storage_network }} not found on host, can't find storage address." when: - swift.storage_network is defined @@ -59,7 +59,7 @@ - swift_storage_address is not defined - name: Get swift storage address (with storage_network) - set_fact: + ansible.builtin.set_fact: swift_storage_address: "{{ ansible_facts[swift_storage_bridge]['ipv4']['address'] }}" when: - swift_storage_bridge is defined @@ -69,7 +69,7 @@ - always - name: Get swift storage address (no storage_network) - set_fact: + ansible.builtin.set_fact: swift_storage_address: "{{ ansible_host }}" when: - swift.storage_network is not defined @@ -79,7 +79,7 @@ # Set swift_replication_address fact so it is consumable in hostvars (for ring.contents template) - name: Set swift_replication_address fact if defined - set_fact: + ansible.builtin.set_fact: swift_replication_address: "{{ swift_replication_address }}" when: - swift_replication_address is defined @@ -88,7 +88,7 @@ # swift_vars.repl_ip always takes precedence - name: Get swift_vars.repl_ip if defined - set_fact: + ansible.builtin.set_fact: swift_replication_address: "{{ swift_vars.repl_ip }}" when: - swift_vars.repl_ip is defined @@ -96,7 +96,7 @@ - always - name: Get swift replication bridge - set_fact: + ansible.builtin.set_fact: swift_replication_bridge: "{{ swift.replication_network | replace('-', '_') }}" when: - swift.replication_network is defined @@ -105,7 +105,7 @@ - always - name: Gather facts for storage_bridge - setup: + ansible.builtin.setup: filter: "{{ swift_replication_bridge }}" when: - swift_replication_bridge is defined @@ -113,7 +113,7 @@ - swift_replication_address is not defined - name: Swift replication address not found - fail: + ansible.builtin.fail: msg: "{{ swift.replication_network }} not found on host, can't find swift_replication_address" when: - swift.replication_network is defined @@ -122,7 +122,7 @@ - swift_replication_address is not defined - name: Get swift replication address (with replication_network) - set_fact: + ansible.builtin.set_fact: swift_replication_address: "{{ ansible_facts[swift_replication_bridge]['ipv4']['address'] }}" when: - swift_replication_bridge is defined @@ -132,7 +132,7 @@ - always - name: Get swift replication address (no replication_network) - set_fact: + ansible.builtin.set_fact: swift_replication_address: "{{ swift_storage_address }}" when: - swift.replication_network is not defined @@ -141,7 +141,7 @@ - always - name: Set swift_dedicated_replication network if storage and replication addresses differ - set_fact: + ansible.builtin.set_fact: swift_dedicated_replication: "{{ swift_storage_address != swift_replication_address }}" tags: - always diff --git a/tasks/swift_check_hashes.yml b/tasks/swift_check_hashes.yml index 89ad86c4..d6b92d66 100644 --- a/tasks/swift_check_hashes.yml +++ b/tasks/swift_check_hashes.yml @@ -14,19 +14,19 @@ # limitations under the License. - name: Test if swift.conf exists - stat: + ansible.builtin.stat: path: "/etc/swift/swift.conf" register: swift_conf - name: Get value of swift_hash_path_suffix from file - command: "awk '/swift_hash_path_suffix/{ print $3 }' /etc/swift/swift.conf" + ansible.builtin.command: "awk '/swift_hash_path_suffix/{ print $3 }' /etc/swift/swift.conf" changed_when: false register: swift_conf_hash_path_suffix when: - swift_conf.stat.exists | bool - name: Fail if swift_hash_path_suffix doesnt match file value - fail: + ansible.builtin.fail: msg: > "The swift_hash_path_suffix variable does not match what is in the file. Check your swift_hash_path_suffix setting in your user_*.yml files in /etc/openstack_deploy @@ -38,14 +38,14 @@ - swift_hash_path_suffix != swift_conf_hash_path_suffix.stdout - name: Get value of swift_hash_path_prefix from file - command: "awk '/swift_hash_path_prefix/{ print $3 }' /etc/swift/swift.conf" + ansible.builtin.command: "awk '/swift_hash_path_prefix/{ print $3 }' /etc/swift/swift.conf" changed_when: false register: swift_conf_hash_path_prefix when: - swift_conf.stat.exists | bool - name: Fail if swift_hash_path_prefix doesnt match file value - fail: + ansible.builtin.fail: msg: > "The swift_hash_path_prefix variable does not match what is in the file. Check your swift_hash_path_prefix setting in your user_*.yml files in /etc/openstack_deploy diff --git a/tasks/swift_install.yml b/tasks/swift_install.yml index 5146b051..591d5eb9 100644 --- a/tasks/swift_install.yml +++ b/tasks/swift_install.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Record the installation method - ini_file: + community.general.ini_file: dest: "/etc/ansible/facts.d/openstack_ansible.fact" section: "swift" option: "install_method" @@ -22,12 +22,12 @@ mode: "0644" - name: Refresh local facts to ensure the swift section is present - setup: + ansible.builtin.setup: filter: ansible_local gather_subset: "!all" - name: Install distro packages - package: + ansible.builtin.package: name: "{{ swift_package_list }}" state: "{{ swift_package_state }}" update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}" @@ -38,7 +38,7 @@ delay: 2 - name: Install the python venv - import_role: + ansible.builtin.import_role: name: "python_venv_build" vars: venv_python_executable: "{{ swift_venv_python_executable }}" @@ -54,5 +54,5 @@ when: swift_install_method == 'source' - name: Including swift_pypy_setup tasks - include_tasks: swift_pypy_setup.yml + ansible.builtin.include_tasks: swift_pypy_setup.yml when: swift_pypy_enabled | bool diff --git a/tasks/swift_key_distribute.yml b/tasks/swift_key_distribute.yml index 2ed10543..fdb1184f 100644 --- a/tasks/swift_key_distribute.yml +++ b/tasks/swift_key_distribute.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Create authorized keys file from host vars - authorized_key: + ansible.posix.authorized_key: user: "{{ swift_system_user_name }}" key: "{{ hostvars[item]['swift_pubkey'] | b64decode }}" with_items: "{{ groups['swift_all'] + groups['swift_remote_all'] }}" diff --git a/tasks/swift_key_populate.yml b/tasks/swift_key_populate.yml index 26383817..b97819aa 100644 --- a/tasks/swift_key_populate.yml +++ b/tasks/swift_key_populate.yml @@ -14,11 +14,11 @@ # limitations under the License. - name: Get public key contents and store as var - slurp: + ansible.builtin.slurp: src: "{{ swift_system_home_folder }}/.ssh/id_rsa.pub" register: swift_pub changed_when: false - name: Register a fact for the swift pub key - set_fact: + ansible.builtin.set_fact: swift_pubkey: "{{ swift_pub.content }}" diff --git a/tasks/swift_key_setup.yml b/tasks/swift_key_setup.yml index 97c4e74d..f9f86d02 100644 --- a/tasks/swift_key_setup.yml +++ b/tasks/swift_key_setup.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Including swift_key_populate tasks - include_tasks: swift_key_populate.yml + ansible.builtin.include_tasks: swift_key_populate.yml - name: Including swift_key_distribute tasks - include_tasks: swift_key_distribute.yml + ansible.builtin.include_tasks: swift_key_distribute.yml diff --git a/tasks/swift_post_install.yml b/tasks/swift_post_install.yml index 7436c326..a4e5777a 100644 --- a/tasks/swift_post_install.yml +++ b/tasks/swift_post_install.yml @@ -39,7 +39,7 @@ - Restart swift services - name: Enable SSHD - systemd: + ansible.builtin.systemd: name: "{{ swift_sshd }}" state: started enabled: true diff --git a/tasks/swift_pre_install.yml b/tasks/swift_pre_install.yml index d44e381e..afc2a3e3 100644 --- a/tasks/swift_pre_install.yml +++ b/tasks/swift_pre_install.yml @@ -14,13 +14,13 @@ # limitations under the License. - name: Create the system group - group: + ansible.builtin.group: name: "{{ swift_system_group_name }}" state: "present" system: "yes" - name: Remove old key file(s) if found - file: + ansible.builtin.file: path: "{{ item }}" state: "absent" with_items: @@ -30,7 +30,7 @@ when: swift_recreate_keys | bool - name: Create the swift system user - user: + ansible.builtin.user: name: "{{ swift_system_user_name }}" group: "{{ swift_system_group_name }}" comment: "{{ swift_system_comment }}" @@ -41,7 +41,7 @@ generate_ssh_key: "yes" - name: Create swift dir - file: + ansible.builtin.file: path: "{{ item.path }}" state: directory owner: "{{ item.owner | default(swift_system_user_name) }}" @@ -62,7 +62,7 @@ - { path: "/etc/rsync.d", owner: "root", group: "root" } - name: Configure mlocate for cron.daily - template: + ansible.builtin.template: src: "mlocate-crond-daily.sh.j2" dest: "/etc/cron.daily/mlocate" mode: "0755" diff --git a/tasks/swift_proxy_hosts.yml b/tasks/swift_proxy_hosts.yml index 10abf657..af3d3cc4 100644 --- a/tasks/swift_proxy_hosts.yml +++ b/tasks/swift_proxy_hosts.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Create and install SSL certificates - include_role: + ansible.builtin.include_role: name: pki tasks_from: main_certs.yml apply: diff --git a/tasks/swift_pypy_setup.yml b/tasks/swift_pypy_setup.yml index 19013791..943487dd 100644 --- a/tasks/swift_pypy_setup.yml +++ b/tasks/swift_pypy_setup.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Download pre-built pypy - get_url: + ansible.builtin.get_url: url: "{{ swift_pypy_archive['url'] }}" checksum: "{{ swift_pypy_archive['checksum'] }}" dest: "/var/cache/{{ swift_pypy_archive['url'] | basename }}" @@ -22,13 +22,13 @@ mode: "0644" - name: Create pypy dir - file: + ansible.builtin.file: path: "/opt/pypy-runtime" state: directory mode: "0755" - name: Unarchive pre-built pypy - unarchive: + ansible.builtin.unarchive: src: "/var/cache/{{ swift_pypy_archive['url'] | basename }}" dest: "/opt/pypy-runtime" copy: "no" @@ -36,7 +36,7 @@ register: local_pypy - name: Setup local pypy - command: "{{ item }}" + ansible.builtin.command: "{{ item }}" changed_when: false with_items: - "{{ swift_pypy_env }} /opt/get-pip.py" @@ -45,19 +45,19 @@ - local_pypy is changed - name: Check for pypy venv - stat: + ansible.builtin.stat: path: "{{ swift_bin | dirname }}/{{ swift_pypy_version }}-inuse" get_checksum: false register: local_pypy_venv_stat - name: Remove existing venv if not pypy setup - file: + ansible.builtin.file: path: "{{ swift_bin | dirname }}" state: absent when: not local_pypy_venv_stat.stat.exists | bool - name: Install pip packages into pypy venv - pip: + ansible.builtin.pip: name: "{{ swift_pip_packages }}" state: "{{ swift_pip_package_state }}" virtualenv: "{{ swift_bin | dirname }}" @@ -75,7 +75,7 @@ - Restart swift services - name: Mark swift venv for use with pypy - file: + ansible.builtin.file: path: "{{ swift_bin | dirname }}/{{ swift_pypy_version }}-inuse" state: "touch" mode: "0644" diff --git a/tasks/swift_rings.yml b/tasks/swift_rings.yml index 85762356..740dad47 100644 --- a/tasks/swift_rings.yml +++ b/tasks/swift_rings.yml @@ -14,22 +14,21 @@ # limitations under the License. - name: Including swift_rings_md5sum tasks - include_tasks: swift_rings_md5sum.yml + ansible.builtin.include_tasks: swift_rings_md5sum.yml - name: Including swift_rings_check tasks - include_tasks: swift_rings_check.yml + ansible.builtin.include_tasks: swift_rings_check.yml when: _swift_is_first_play_host - name: Including swift_rings_build tasks - include_tasks: swift_rings_build.yml + ansible.builtin.include_tasks: swift_rings_build.yml when: _swift_is_first_play_host - name: Including swift_rings_distribute tasks - include_tasks: swift_rings_distribute.yml - + ansible.builtin.include_tasks: swift_rings_distribute.yml - name: Including swift_rings_md5sum tasks - include_tasks: swift_rings_md5sum.yml + ansible.builtin.include_tasks: swift_rings_md5sum.yml - name: Including swift_rings_post_distribution_check tasks - include_tasks: swift_rings_post_distribution_check.yml + ansible.builtin.include_tasks: swift_rings_post_distribution_check.yml when: _swift_is_first_play_host diff --git a/tasks/swift_rings_build.yml b/tasks/swift_rings_build.yml index 26b68dec..3e13e3cb 100644 --- a/tasks/swift_rings_build.yml +++ b/tasks/swift_rings_build.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: "Copy the swift_rings.py file" - template: + ansible.builtin.template: src: swift_rings.py.j2 dest: "/etc/swift/scripts/swift_rings.py" owner: "{{ swift_system_user_name }}" @@ -24,7 +24,7 @@ - swift-install - name: "Build ring-contents files" - template: + ansible.builtin.template: src: ring.contents.j2 dest: "/etc/swift/scripts/{{ item.type }}.contents" owner: "{{ swift_system_user_name }}" @@ -35,7 +35,7 @@ - { item: "{{ swift.container | default({}) }}", port: "{{ swift_container_port }}", type: "container" } - name: "Build ring-contents files for storage policies" - template: + ansible.builtin.template: src: ring.contents.j2 dest: "/etc/swift/scripts/object-{{ item[0].policy.index }}.contents" owner: "{{ swift_system_user_name }}" @@ -46,7 +46,7 @@ - [{ type: "object", port: "{{ swift_object_port }}" }] - name: Ensure swift config directory permissions - file: + ansible.builtin.file: path: /etc/swift/ state: directory owner: "{{ swift_system_user_name }}" @@ -55,7 +55,7 @@ when: swift_install_method == 'distro' - name: "Build rings for account/container from contents files" - command: >- + ansible.builtin.command: >- /etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/{{ item[0] }}.contents{% if item[1] %} -r {{ item[1] }}{% endif %}{{ (swift_pretend_min_part_hours_passed | bool) | ternary(' -p', '') }} with_nested: @@ -70,7 +70,7 @@ chdir: /etc/swift/ring_build_files/ - name: "Build rings for storage policies from contents files" - command: >- + ansible.builtin.command: >- /etc/swift/scripts/swift_rings.py -f /etc/swift/scripts/object-{{ item[0].policy.index }}.contents{% if item[1] %} -r {{ item[1] }}{% endif %}{{ (swift_pretend_min_part_hours_passed | bool) | ternary(' -p', '') }} with_nested: diff --git a/tasks/swift_rings_check.yml b/tasks/swift_rings_check.yml index 49003689..046a15b8 100644 --- a/tasks/swift_rings_check.yml +++ b/tasks/swift_rings_check.yml @@ -14,13 +14,13 @@ # limitations under the License. - name: Get md5sum of local builder files - shell: | + ansible.builtin.shell: | cat /etc/swift/ring_build_files/*.builder 2>/dev/null | md5sum | cut -d " " -f1 changed_when: false register: md5sum - name: Get empty md5sum - shell: | + ansible.builtin.shell: | echo -n | md5sum | cut -d " " -f1 changed_when: false register: empty_md5sum @@ -28,7 +28,7 @@ # Fail if the remote hosts builder files is not empty AND # does not match the md5sum of the local host. - name: Verify md5sum of builder files - fail: + ansible.builtin.fail: msg: > "The builder files on the remote host {{ item }}:{{ hostvars[item]['builder_md5sum'] }} do not match {{ inventory_hostname }}:{{ md5sum.stdout }} diff --git a/tasks/swift_rings_distribute.yml b/tasks/swift_rings_distribute.yml index e5b95e82..06e622b3 100644 --- a/tasks/swift_rings_distribute.yml +++ b/tasks/swift_rings_distribute.yml @@ -14,14 +14,14 @@ # limitations under the License. - name: Pull swift rings to localhost - synchronize: + ansible.posix.synchronize: src: /etc/swift/ring_build_files/ dest: "{{ lookup('env', 'OSA_CONFIG_DIR') }}/ring_build_files/" mode: pull when: _swift_is_first_play_host - name: Upload swift rings - synchronize: + ansible.posix.synchronize: src: "{{ lookup('env', 'OSA_CONFIG_DIR') }}/ring_build_files/" dest: "{{ item }}" mode: push diff --git a/tasks/swift_rings_md5sum.yml b/tasks/swift_rings_md5sum.yml index 56d42533..34a9ced7 100644 --- a/tasks/swift_rings_md5sum.yml +++ b/tasks/swift_rings_md5sum.yml @@ -14,11 +14,11 @@ # limitations under the License. - name: Get md5sum of builder files - shell: | + ansible.builtin.shell: | cat /etc/swift/*.builder 2>/dev/null | md5sum | cut -d " " -f1 changed_when: false register: md5sum - name: Register a fact for the md5sum - set_fact: + ansible.builtin.set_fact: builder_md5sum: "{{ md5sum.stdout }}" diff --git a/tasks/swift_rings_post_distribution_check.yml b/tasks/swift_rings_post_distribution_check.yml index 7c6a5b5c..1f4d32ae 100644 --- a/tasks/swift_rings_post_distribution_check.yml +++ b/tasks/swift_rings_post_distribution_check.yml @@ -14,7 +14,7 @@ # limitations under the License. - name: Get md5sum of local builder files - shell: | + ansible.builtin.shell: | cat /etc/swift/ring_build_files/*.builder 2>/dev/null | md5sum | cut -d " " -f1 changed_when: false register: md5sum @@ -22,7 +22,7 @@ # Fail if the remote hosts builder files don't match # As this is post sync all should match and not be empty - name: Verify md5sum of builder files - fail: + ansible.builtin.fail: msg: > "The builder files on the remote host {{ item }}:{{ hostvars[item]['builder_md5sum'] }} do not match {{ inventory_hostname }}:{{ md5sum.stdout }}" @@ -30,7 +30,7 @@ with_items: "{{ groups['swift_all'] + groups['swift_remote_all'] }}" - name: "Copy the swift_rings_check.py file" - template: + ansible.builtin.template: src: swift_rings_check.py.j2 dest: "/etc/swift/scripts/swift_rings_check.py" owner: "{{ swift_system_user_name }}" @@ -40,7 +40,7 @@ - swift-install - name: "Ensure contents file matches ring after ring sync for account/container" - command: "/etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/{{ item[0] }}.contents{% if item[1] %} -r {{ item[1] }} {% endif %}" + ansible.builtin.command: "/etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/{{ item[0] }}.contents{% if item[1] %} -r {{ item[1] }} {% endif %}" changed_when: false with_nested: - ["account", "container"] @@ -51,7 +51,7 @@ chdir: /etc/swift/ring_build_files/ - name: "Ensure contents file matches ring after ring sync for storage policies" - command: >- + ansible.builtin.command: >- /etc/swift/scripts/swift_rings_check.py -f /etc/swift/scripts/object-{{ item[0].policy.index }}.contents{% if item[1] %} -r {{ item[1] }} {% endif %} changed_when: false with_nested: diff --git a/tasks/swift_storage_hosts.yml b/tasks/swift_storage_hosts.yml index 74ce33d1..8065480c 100644 --- a/tasks/swift_storage_hosts.yml +++ b/tasks/swift_storage_hosts.yml @@ -14,10 +14,10 @@ # limitations under the License. - name: Including swift_storage_hosts_setup tasks - include_tasks: swift_storage_hosts_setup.yml + ansible.builtin.include_tasks: swift_storage_hosts_setup.yml - name: Including swift_storage_hosts_object tasks - include_tasks: swift_storage_hosts_object.yml + ansible.builtin.include_tasks: swift_storage_hosts_object.yml - name: Including swift_storage_hosts_account tasks - include_tasks: swift_storage_hosts_account.yml + ansible.builtin.include_tasks: swift_storage_hosts_account.yml - name: Including swift_storage_hosts_container tasks - include_tasks: swift_storage_hosts_container.yml + ansible.builtin.include_tasks: swift_storage_hosts_container.yml diff --git a/tasks/swift_storage_hosts_account.yml b/tasks/swift_storage_hosts_account.yml index 45c8a849..c1940ca1 100644 --- a/tasks/swift_storage_hosts_account.yml +++ b/tasks/swift_storage_hosts_account.yml @@ -39,7 +39,7 @@ # Remove the dedicated replicator configuration when no dedicated replication network in use - name: "Remove dedicated replicator configuration" - file: + ansible.builtin.file: state: absent path: "/etc/swift/account-server/account-server-replicator.conf" when: not swift_dedicated_replication | bool diff --git a/tasks/swift_storage_hosts_container.yml b/tasks/swift_storage_hosts_container.yml index 81f20fa9..cfea9b23 100644 --- a/tasks/swift_storage_hosts_container.yml +++ b/tasks/swift_storage_hosts_container.yml @@ -66,7 +66,7 @@ # Remove the dedicated replicator configuration when no dedicated replication network in use - name: "Remove dedicated replicator configuration" - file: + ansible.builtin.file: state: absent path: "/etc/swift/container-server/container-server-replicator.conf" when: not swift_dedicated_replication | bool diff --git a/tasks/swift_storage_hosts_object.yml b/tasks/swift_storage_hosts_object.yml index 7a16802c..7da297fb 100644 --- a/tasks/swift_storage_hosts_object.yml +++ b/tasks/swift_storage_hosts_object.yml @@ -48,7 +48,7 @@ # Remove the dedicated replicator configuration when no dedicated replication network in use - name: "Remove dedicated replicator configuration" - file: + ansible.builtin.file: state: absent path: "/etc/swift/object-server/object-server-replicator.conf" when: not swift_dedicated_replication | bool @@ -64,7 +64,7 @@ config_type: "ini" - name: Create drive-audit cron job - cron: + ansible.builtin.cron: name: "Run drive-audit script" job: "{{ swift_bin }}/swift-drive-audit /etc/swift/drive-audit.conf" minute: 15 diff --git a/tasks/swift_storage_hosts_setup.yml b/tasks/swift_storage_hosts_setup.yml index c72ccef1..e8aef3d9 100644 --- a/tasks/swift_storage_hosts_setup.yml +++ b/tasks/swift_storage_hosts_setup.yml @@ -14,12 +14,12 @@ # limitations under the License. - name: "Enable nf_conntrack" - modprobe: + community.general.modprobe: name: "nf_conntrack" state: present - name: "Set sysctl tcp_tw_reuse" - sysctl: + ansible.posix.sysctl: name: "net.ipv4.tcp_tw_reuse" state: present value: "1" @@ -28,7 +28,7 @@ delegate_to: "{{ physical_host }}" - name: "Set sysctl file-max" - sysctl: + ansible.posix.sysctl: name: "fs.file-max" state: present value: "{{ swift_max_file_limits }}" @@ -37,7 +37,7 @@ delegate_to: "{{ physical_host }}" - name: "Put /etc/rsyncd.conf in place" - template: + ansible.builtin.template: src: "rsyncd.conf.j2" dest: "/etc/rsyncd.conf" owner: "root" @@ -47,7 +47,7 @@ # Red Hat/CentOS are enabled as part of the handler - name: "Enable rsync service in defaults (Debian)" - lineinfile: + ansible.builtin.lineinfile: dest: "/etc/default/rsync" line: "RSYNC_ENABLE=true" regexp: "^RSYNC_ENABLE*" @@ -55,7 +55,7 @@ notify: "Restart rsync service" - name: "Setup swift-recon-cron cron job" - cron: + ansible.builtin.cron: name: "swift-recon-cron run" minute: "*/5" user: "swift" @@ -63,7 +63,7 @@ cron_file: "swift_recon_cron" - name: "Set ownership on mounted drives" - file: + ansible.builtin.file: dest: "{{ swift_vars.mount_point | default(swift.mount_point) }}/{{ item.name }}" owner: "{{ swift_system_user_name }}" group: "{{ swift_system_group_name }}"