Last active
October 1, 2015 23:01
-
-
Save mgagne/4f0012b0804d8541e362 to your computer and use it in GitHub Desktop.
Optional synchronize
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
--- | |
- name: "Deploy project" | |
hosts: all | |
gather_facts: false | |
vars: | |
artifacts: | |
- src: "./repository/" | |
dest: "/target/repository" | |
- src: "./manifests/" | |
dest: "/target/manifests" | |
- src: "./target/modules/" | |
dest: "/target/modules" | |
- src: "./hieradata/hieradata/" | |
dest: "/target/hieradata" | |
optional: True | |
tasks: | |
- name: Check artifacts existence | |
stat: | |
path: "{{ item.src }}" | |
with_items: artifacts | |
register: artifacts_stat | |
delegate_to: 127.0.0.1 | |
- name: Synchronize artifacts | |
synchronize: | |
src: "{{ item.1.src }}" | |
dest: "{{ item.1.dest }}" | |
with_indexed_items: artifacts | |
when: > | |
not item.1.optional|default(False) or | |
artifacts_stat.results[item.0].stat.exists |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment