diff --git a/tasks/main.yml b/tasks/main.yml index 4cb9c6b2..95ed9a69 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -59,6 +59,13 @@ tags: - swift-install +- name: Importing swift_key_setup tasks + ansible.builtin.import_tasks: swift_key_setup.yml + when: + - "swift_do_sync | bool" + tags: + - swift-config + - name: Importing swift_install tasks ansible.builtin.import_tasks: swift_install.yml when: @@ -99,13 +106,6 @@ tags: - swift-config -- name: Importing swift_key_setup tasks - ansible.builtin.import_tasks: swift_key_setup.yml - when: - - "swift_do_sync | bool" - tags: - - swift-config - - name: Importing swift_rings tasks ansible.builtin.import_tasks: swift_rings.yml when: diff --git a/tasks/swift_key_setup.yml b/tasks/swift_key_setup.yml index 0444fc4c..43067fed 100644 --- a/tasks/swift_key_setup.yml +++ b/tasks/swift_key_setup.yml @@ -37,3 +37,6 @@ ssh_keypairs_principals: "{{ swift_ssh_keypairs_principals }}" tags: - always + +- name: Ensure SSH is restarted + ansible.builtin.meta: flush_handlers diff --git a/tasks/swift_rings_check.yml b/tasks/swift_rings_check.yml index 046a15b8..92e8f87b 100644 --- a/tasks/swift_rings_check.yml +++ b/tasks/swift_rings_check.yml @@ -15,7 +15,7 @@ - name: Get md5sum of local builder files ansible.builtin.shell: | - cat /etc/swift/ring_build_files/*.builder 2>/dev/null | md5sum | cut -d " " -f1 + cat /etc/swift/*.builder 2>/dev/null | md5sum | cut -d " " -f1 changed_when: false register: md5sum diff --git a/tasks/swift_rings_distribute.yml b/tasks/swift_rings_distribute.yml index 06e622b3..c2e61049 100644 --- a/tasks/swift_rings_distribute.yml +++ b/tasks/swift_rings_distribute.yml @@ -13,18 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Pull swift rings to localhost - ansible.posix.synchronize: - src: /etc/swift/ring_build_files/ - dest: "{{ lookup('env', 'OSA_CONFIG_DIR') }}/ring_build_files/" - mode: pull +- name: Distribute rings + command: > + rsync -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' + -avz + /etc/swift/ring_build_files/ + {{ swift_system_user_name }}@{{ hostvars[item]['ansible_host'] | default(item) }}:/etc/swift/ + become: true + become_user: "{{ swift_system_user_name }}" + changed_when: false + with_items: "{{ groups['swift_all'] }}" when: _swift_is_first_play_host - -- name: Upload swift rings - ansible.posix.synchronize: - src: "{{ lookup('env', 'OSA_CONFIG_DIR') }}/ring_build_files/" - dest: "{{ item }}" - mode: push - with_items: - - /etc/swift/ - - /etc/swift/ring_build_files/ + tags: + - skip_ansible_lint diff --git a/tasks/swift_rings_post_distribution_check.yml b/tasks/swift_rings_post_distribution_check.yml index 1f4d32ae..323718b6 100644 --- a/tasks/swift_rings_post_distribution_check.yml +++ b/tasks/swift_rings_post_distribution_check.yml @@ -15,7 +15,7 @@ - name: Get md5sum of local builder files ansible.builtin.shell: | - cat /etc/swift/ring_build_files/*.builder 2>/dev/null | md5sum | cut -d " " -f1 + cat /etc/swift/*.builder 2>/dev/null | md5sum | cut -d " " -f1 changed_when: false register: md5sum @@ -48,7 +48,7 @@ become: true become_user: "{{ swift_system_user_name }}" args: - chdir: /etc/swift/ring_build_files/ + chdir: /etc/swift/ - name: "Ensure contents file matches ring after ring sync for storage policies" ansible.builtin.command: >- @@ -60,4 +60,4 @@ become: true become_user: "{{ swift_system_user_name }}" args: - chdir: /etc/swift/ring_build_files/ + chdir: /etc/swift/