Rework the persistent volume attach to not have errors that are ignored.

This commit is contained in:
Kevin Fenzi 2016-06-25 17:26:01 +00:00
parent 68fbcbd52b
commit 4ed8d5e0ab

View file

@ -44,11 +44,21 @@
# instance can be both id and name, volume must be id
# volume must be id
- local_action: shell nova --os-auth-url="{{os_auth_url}}" --os-username="admin" --os-password="{{ADMIN_PASS}}" --os-tenant-name={{inventory_tenant}} volume-list | grep ' {{item.volume_id}} ' | grep 'available' && nova --os-auth-url="{{os_auth_url}}" --os-username="admin" --os-password="{{ADMIN_PASS}}" --os-tenant-name={{inventory_tenant}} volume-attach "{{inventory_instance_name}}" "{{item.volume_id}}" "{{item.device}}"
#
# Check that the volume is available
#
- local_action: shell nova --os-auth-url="{{os_auth_url}}" --os-username="admin" --os-password="{{ADMIN_PASS}}" --os-tenant-name={{inventory_tenant}} volume-list | grep ' {{item.volume_id}} ' | grep 'available'
with_items: "{{volumes}}"
ignore_errors: yes
register: volume_available
when: volumes is defined
#
# If it is attach it.
#
- local_action: shell nova --os-auth-url="{{os_auth_url}}" --os-username="admin" --os-password="{{ADMIN_PASS}}" --os-tenant-name={{inventory_tenant}} volume-attach "{{inventory_instance_name}}" "{{item.volume_id}}" "{{item.device}}"
with_items: "{{volumes}}"
when: volume_available|success
- name: wait for he host to be hot
local_action: wait_for host={{ public_ip }} port=22 delay=1 timeout=600
when: host_is_up|failed