Merge "Fix swift_ring_rebalance.yaml playbook"
This commit is contained in:
commit
320eed7ddf
|
@ -8,18 +8,18 @@
|
||||||
vars:
|
vars:
|
||||||
base_directory: "/var/lib/config-data/puppet-generated/swift/"
|
base_directory: "/var/lib/config-data/puppet-generated/swift/"
|
||||||
rebalance_is_safe: false
|
rebalance_is_safe: false
|
||||||
environment:
|
plan: overcloud
|
||||||
OS_STORAGE_URL: "{{ hostvars.localhost.undercloud_swift_url }}"
|
|
||||||
OS_AUTH_TOKEN: "{{ hostvars.localhost.os_auth_token }}"
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Get reference ring checksum
|
- name: Get reference ring checksum
|
||||||
run_once: true
|
run_once: true
|
||||||
|
delegate_to: localhost
|
||||||
block:
|
block:
|
||||||
- name: Ensure /tmp/swift-rings directory exists
|
- name: Ensure /tmp/swift-rings directory exists
|
||||||
file: path=/tmp/swift-rings state=directory
|
file: path=/tmp/swift-rings state=directory
|
||||||
|
|
||||||
- name: Fetch Swift rings from undercloud
|
- name: Fetch Swift rings from undercloud
|
||||||
command: swift --insecure download -o /tmp/swift-rings.tar.gz overcloud-swift-rings swift-rings.tar.gz
|
command: |-
|
||||||
|
openstack --os-cloud undercloud object save --file /tmp/swift-rings.tar.gz "{{plan~'-swift-rings'}}" swift-rings.tar.gz
|
||||||
|
|
||||||
- name: Extract Swift rings
|
- name: Extract Swift rings
|
||||||
unarchive:
|
unarchive:
|
||||||
|
@ -46,18 +46,19 @@
|
||||||
- (result_reference.stat.checksum != result.stat.checksum)
|
- (result_reference.stat.checksum != result.stat.checksum)
|
||||||
|
|
||||||
- name: Deploy missing Swift rings
|
- name: Deploy missing Swift rings
|
||||||
when:
|
|
||||||
- not (result.stat.exists | bool)
|
|
||||||
block:
|
block:
|
||||||
- name: Fetch missing Swift rings from undercloud
|
- name: Copy to remote host
|
||||||
command: swift --insecure download -o /tmp/swift-rings.tar.gz overcloud-swift-rings swift-rings.tar.gz
|
synchronize:
|
||||||
|
src: /tmp/swift-rings.tar.gz
|
||||||
|
dest: /tmp/swift-rings.tar.gz
|
||||||
|
|
||||||
- name: Extract missing Swift rings
|
- name: Extract missing Swift rings
|
||||||
unarchive:
|
unarchive:
|
||||||
src: /tmp/swift-rings.tar.gz
|
src: /tmp/swift-rings.tar.gz
|
||||||
dest: /{{ base_directory }}
|
dest: /{{ base_directory }}
|
||||||
remote_src: true
|
remote_src: true
|
||||||
become: true
|
when:
|
||||||
|
- not (result.stat.exists | bool)
|
||||||
|
|
||||||
- name: Get recon data
|
- name: Get recon data
|
||||||
command: cat /var/cache/swift/object.recon
|
command: cat /var/cache/swift/object.recon
|
||||||
|
@ -88,8 +89,10 @@
|
||||||
- name: Ensure /tmp/swift-rings directory exists
|
- name: Ensure /tmp/swift-rings directory exists
|
||||||
file: path=/tmp/swift-rings state=directory
|
file: path=/tmp/swift-rings state=directory
|
||||||
|
|
||||||
- name: Fetch Swift rings from undercloud
|
- name: Copy to remote host
|
||||||
command: swift --insecure download -o /tmp/swift-rings.tar.gz overcloud-swift-rings swift-rings.tar.gz
|
synchronize:
|
||||||
|
src: /tmp/swift-rings.tar.gz
|
||||||
|
dest: /tmp/swift-rings.tar.gz
|
||||||
|
|
||||||
- name: Extract Swift rings
|
- name: Extract Swift rings
|
||||||
unarchive:
|
unarchive:
|
||||||
|
@ -97,15 +100,27 @@
|
||||||
dest: /tmp/swift-rings
|
dest: /tmp/swift-rings
|
||||||
remote_src: true
|
remote_src: true
|
||||||
|
|
||||||
# Can't use with_fileglob (see https://github.com/ansible/ansible/issues/17136)
|
- 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
|
- name: Rebalance Swift rings
|
||||||
command: swift-ring-builder /tmp/swift-rings/etc/swift/{{ item }} rebalance
|
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:
|
with_items:
|
||||||
- object.builder
|
- object.builder
|
||||||
- container.builder
|
- container.builder
|
||||||
- account.builder
|
- account.builder
|
||||||
failed_when: result.rc > 1
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Create Swift ring archive
|
- name: Create Swift ring archive
|
||||||
archive:
|
archive:
|
||||||
|
@ -113,13 +128,23 @@
|
||||||
- "/tmp/swift-rings/etc"
|
- "/tmp/swift-rings/etc"
|
||||||
dest: /tmp/swift-rings.tar.gz
|
dest: /tmp/swift-rings.tar.gz
|
||||||
|
|
||||||
- name: Copy Swift rings to the undercloud
|
- name: Fetch from remote host
|
||||||
command: swift --insecure upload --object-name swift-rings.tar.gz overcloud-swift-rings /tmp/swift-rings.tar.gz
|
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
|
- name: Update Swift rings on all nodes
|
||||||
block:
|
block:
|
||||||
- name: Fetch Swift rings from undercloud
|
- name: Copy to remote host
|
||||||
command: swift --insecure download -o /tmp/swift-rings.tar.gz overcloud-swift-rings swift-rings.tar.gz
|
synchronize:
|
||||||
|
src: /tmp/swift-rings.tar.gz
|
||||||
|
dest: /tmp/swift-rings.tar.gz
|
||||||
|
|
||||||
- name: Extract Swift rings
|
- name: Extract Swift rings
|
||||||
unarchive:
|
unarchive:
|
||||||
|
|
Loading…
Reference in New Issue