Rework the persistent volume attach to not have errors that are ignored.
This commit is contained in:
parent
68fbcbd52b
commit
4ed8d5e0ab
1 changed files with 12 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue