Created
December 15, 2017 18:25
-
-
Save hoonetorg/c5f9580390adcf4fe5704818f5cedbbd to your computer and use it in GitHub Desktop.
ansible shell command only if another shell command does the correct thing when looping over a list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vars: | |
drbdmanage_m: | |
volumes: | |
- name: server1_disk1 | |
size: 30G | |
- name: server1_disk2 | |
size: 30G | |
task: | |
--- | |
- name: drbdmanage_check_volume_exists_{{item.name}} | |
shell: "drbdmanage list-volumes" | |
register: existing_drbdmanage_volumes | |
with_items: | |
- "{{ drbdmanage_m.volumes }}" | |
when: | |
- inventory_hostname in [ drbdmanage_deploy_node ] | |
- name: drbdmanage_add_volume_{{item.name}} | |
shell: "drbdmanage add-volume {{ item.name }} {{ item.size }}" | |
with_items: | |
- "{{ <<??? yeah which items and must registered var "existing_drbdmanage_volumes" be used here also ???>> }}" | |
when: | |
- "{{ <<??? how to check registered var "existing_drbdmanage_volumes" correctly ???>> }}" | |
- inventory_hostname in [ drbdmanage_deploy_node ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment