summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2015-03-06 15:15:01 +0000
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2015-03-06 15:15:01 +0000
commit689b17c4b7d5708319b154725ec22c8c2c4be532 (patch)
tree6e4ab947beda0c7a055bb9eff45ecf54cbe9d163
parent929f8894528a519f0a776996acca071f3e629c63 (diff)
downloaddefinitions-689b17c4b7d5708319b154725ec22c8c2c4be532.tar.gz
swift-controller.yml: Only create rings when they're not already there
This whole thing should be encapsulated somehow so we're not repating the conditional, but I don't know how to do that with ansible at the moment.
-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