From bc999a6dcfeeeacbe1d2f53a1d9720fedcd6dae0 Mon Sep 17 00:00:00 2001 From: Christian Schwede Date: Thu, 3 Sep 2020 13:56:25 +0200 Subject: [PATCH] Remove swift_ring_rebalance.yaml playbook This playbook has a few minor issues, and is no longer used. Instead of fixing unused code, let's simply remove it. Change-Id: I3d21e4596d0d0b8b5a1153c2e3dc85ede850a3b2 --- .../playbooks/swift_ring_rebalance.yaml | 154 ------------------ 1 file changed, 154 deletions(-) delete mode 100644 tripleo_ansible/playbooks/swift_ring_rebalance.yaml diff --git a/tripleo_ansible/playbooks/swift_ring_rebalance.yaml b/tripleo_ansible/playbooks/swift_ring_rebalance.yaml deleted file mode 100644 index 41662e0c4..000000000 --- a/tripleo_ansible/playbooks/swift_ring_rebalance.yaml +++ /dev/null @@ -1,154 +0,0 @@ ---- - -- name: Update Swift rings - hosts: swift_storage,swift_proxy - gather_facts: false - any_errors_fatal: true - max_fail_percentage: 0 - vars: - base_directory: "/var/lib/config-data/puppet-generated/swift/" - rebalance_is_safe: false - plan: overcloud - tasks: - - name: Get reference ring checksum - run_once: true - delegate_to: localhost - block: - - name: Ensure /tmp/swift-rings directory exists - file: path=/tmp/swift-rings state=directory - - - name: Fetch Swift rings from undercloud - command: |- - openstack --os-cloud undercloud object save --file /tmp/swift-rings.tar.gz "{{plan~'-swift-rings'}}" swift-rings.tar.gz - - - name: Extract Swift rings - unarchive: - src: /tmp/swift-rings.tar.gz - dest: /tmp/swift-rings - remote_src: true - - - name: Get reference ring checksum - stat: - path: /tmp/swift-rings/etc/swift/object.ring.gz - register: result_reference - - - name: Get file attributes of object rings - stat: - path: "{{ base_directory }}/etc/swift/object.ring.gz" - register: result - - - name: Abort playbook run if consistency check fails - fail: - msg: "object.ring.gz does not match reference checksum" - when: - - (result.stat.exists | bool) - - (result_reference.stat.exists | bool) - - (result_reference.stat.checksum != result.stat.checksum) - - - name: Deploy missing Swift rings - block: - - name: Copy to remote host - synchronize: - src: /tmp/swift-rings.tar.gz - dest: /tmp/swift-rings.tar.gz - - - name: Extract missing Swift rings - unarchive: - src: /tmp/swift-rings.tar.gz - dest: /{{ base_directory }} - remote_src: true - when: - - not (result.stat.exists | bool) - - - name: Get recon data - command: cat /var/cache/swift/object.recon - register: recon - become: true - - - name: Check if it is safe to continue rebalancing - set_fact: - rebalance_is_safe: true - when: - - (result.stat.exists | bool) - - ((recon.stdout | from_json).object_replication_last | int) > ((result.stat.mtime) | int) - - - name: Show warning and stop playbook run if unsafe - debug: - msg: "Rebalancing is unsafe at the moment, stopping. Please try again later" - when: - - not (rebalance_is_safe | bool) - - # We exit here in case there is at least one host that fails the above check - - meta: end_play - when: - - not (rebalance_is_safe | bool) - - - name: Rebalance Swift rings - run_once: true - block: - - name: Ensure /tmp/swift-rings directory exists - file: path=/tmp/swift-rings state=directory - - - name: Copy to remote host - synchronize: - src: /tmp/swift-rings.tar.gz - dest: /tmp/swift-rings.tar.gz - - - name: Extract Swift rings - unarchive: - src: /tmp/swift-rings.tar.gz - dest: /tmp/swift-rings - remote_src: true - - - name: Get swift_proxy container info - podman_container_info: - name: swift_proxy - register: swift_proxy_info - become: true - - - name: Set swift_proxy image name - set_fact: - swift_proxy_image: "{{ (swift_proxy_info.containers | map(attribute='ImageName')) | first }}" - - - name: Rebalance Swift rings - podman_container: - name: temp_rebalace - image: "{{swift_proxy_image}}" - network: none - volume: /tmp/swift-rings:/tmp/swift-rings - command: swift-ring-builder /tmp/swift-rings/etc/swift/{{ item }} rebalance - with_items: - - object.builder - - container.builder - - account.builder - - - name: Create Swift ring archive - archive: - path: - - "/tmp/swift-rings/etc" - dest: /tmp/swift-rings.tar.gz - - - name: Fetch from remote host - fetch: - src: /tmp/swift-rings.tar.gz - dest: /tmp/swift-rings.tar.gz - flat: true - - - name: Upload swift rings to the undercloud - command: |- - openstack --os-cloud undercloud object create --name swift-rings.tar.gz "{{ plan~'-swift-rings'}}" /tmp/swift-rings.tar.gz - delegate_to: localhost - - - name: Update Swift rings on all nodes - block: - - name: Copy to remote host - synchronize: - src: /tmp/swift-rings.tar.gz - dest: /tmp/swift-rings.tar.gz - - - name: Extract Swift rings - unarchive: - src: /tmp/swift-rings.tar.gz - dest: /{{ base_directory }} - remote_src: true - become: true