Created
October 4, 2017 12:03
-
-
Save Hounddog/27722348a19e77e0b630203efd91a283 to your computer and use it in GitHub Desktop.
Iterate only when changed
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
"Repositories": { | |
"changed": true, | |
"msg": "All items completed", | |
"results": [ | |
{ | |
"_ansible_item_result": true, | |
"_ansible_no_log": false, | |
"_ansible_parsed": true, | |
"after": "2bebc339d977194c9029310a3f1f49dac2ea61ee", | |
"before": "2bebc339d977194c9029310a3f1f49dac2ea61ee", | |
"changed": false, | |
"invocation": { | |
"module_args": { | |
"accept_hostkey": true, | |
"bare": false, | |
"clone": true, | |
"depth": null, | |
"dest": "/efs-gp/AWSTEST/ansible/rocketchat/", | |
"executable": null, | |
"force": false, | |
"key_file": null, | |
"recursive": true, | |
"reference": null, | |
"refspec": null, | |
"remote": "origin", | |
"repo": "[email protected]:DOC-Compose/rocketchat.git", | |
"ssh_opts": null, | |
"track_submodules": false, | |
"umask": null, | |
"update": true, | |
"verify_commit": false, | |
"version": "feature-swarm-mode" | |
} | |
}, | |
"item": { | |
"key": "rocketchat", | |
"value": { | |
"git": { | |
"branch": "feature-swarm-mode", | |
"repo": "[email protected]:DOC-Compose/rocketchat.git" | |
} | |
} | |
}, | |
"remote_url_changed": false | |
}, |
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
tasks: | |
- name: Clone Repositories | |
git: | |
accept_hostkey: true | |
repo: "{{ item.value.git.repo }}" | |
dest: "{{destination}}/{{item.key}}/" | |
version: "{{item.value.git.branch}}" | |
register: Repositories | |
with_dict: "{{ services }}" | |
- name: Debug managed | |
debug: | |
var: Repositories | |
- name: Deploy Services | |
shell: docker stack deploy -c {{ destination }}/{{ item.key }}/docker-compose.yml {{ item.key }} | |
args: | |
chdir: "{{ destination }}/{{ item.key }}" | |
with_dict: "{{ Repositories }}" | |
when: {{ Repositories.item.changed }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment