From 530fae32e00ead64d695d6e1db8525a78946a620 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Tue, 16 Dec 2014 00:36:05 +0100 Subject: Split creation and erasure in 2 differents actions This permit to reduce the number of "changed" in the output and unneed churn. Could be factored in 1 action if my PR is accepted. --- roles/git_repositories/tasks/main.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'roles') diff --git a/roles/git_repositories/tasks/main.yml b/roles/git_repositories/tasks/main.yml index 112e372..21f7513 100644 --- a/roles/git_repositories/tasks/main.yml +++ b/roles/git_repositories/tasks/main.yml @@ -22,9 +22,17 @@ - shell: creates={{ git_repositories_dir }}/{{ item.name }}/config chdir={{ git_repositories_dir }}/{{ item.name }} git init --bare -q --shared=group with_items: git_repositories +# refactor this one and the next if https://github.com/ansible/ansible-modules-core/pull/520 is merged - file: path: "{{ git_repositories_dir }}/{{ item.name }}/git-daemon-export-ok" - state: "{% if item.private is defined and item.private %}absent{% else %}touch{% endif %}" + state: absent + when: item.private is defined and item.private + with_items: git_repositories + +- copy: + dest: "{{ git_repositories_dir }}/{{ item.name }}/git-daemon-export-ok" + content: "" + when: item.private is not defined or not item.private with_items: git_repositories - copy: -- cgit