summaryrefslogtreecommitdiff
path: root/openstack/usr/share/openstack/swift-controller.yml
diff options
context:
space:
mode:
Diffstat (limited to 'openstack/usr/share/openstack/swift-controller.yml')
-rw-r--r--openstack/usr/share/openstack/swift-controller.yml24
1 files changed, 16 insertions, 8 deletions
diff --git a/openstack/usr/share/openstack/swift-controller.yml b/openstack/usr/share/openstack/swift-controller.yml
index 7f180534..5114de5c 100644
--- a/openstack/usr/share/openstack/swift-controller.yml
+++ b/openstack/usr/share/openstack/swift-controller.yml
@@ -32,22 +32,30 @@
region='RegionOne'
token={{ KEYSTONE_TEMPORARY_ADMIN_TOKEN }}
+ - shell: test -f /etc/swift/{{ item }}.ring.gz
+ with_items: rings
+ register: rings-exist
+
- name: Create ring
- shell: swift-ring-builder {{ item }}.builder create {{ SWIFT_PART_POWER }}
+ shell: swift-ring-builder {{ item.item }}.builder create {{ SWIFT_PART_POWER }}
{{ SWIFT_REPLICAS }} {{ SWIFT_MIN_PART_HOURS }}
- with_items: rings
+ when: item.rc != 0
+ with_items: rings-exist.results
- name: Add each storage node to the ring
- shell: swift-ring-builder {{ item[0] }}.builder
+ shell: swift-ring-builder {{ item[0].item }}.builder
add r1z1-{{ item[1].ip }}:6002/{{ item[1].device }} {{ item[1].weight }}
+ when: item[0].rc != 0
with_nested:
- - rings
+ - rings-exist.results
- SWIFT_STORAGE_DEVICES
- name: Rebalance the ring
- shell: swift-ring-builder {{ item }}.builder rebalance
- with_items: rings
+ shell: swift-ring-builder {{ item.item }}.builder rebalance
+ when: item.rc != 0
+ with_items: rings-exist.results
- name: Distribute ring configuration files
- shell: cp {{ item }}.ring.gz /etc/swift
- with_items: rings
+ shell: cp {{ item.item }}.ring.gz /etc/swift
+ when: item.rc != 0
+ with_items: rings-exist.results