Only oc apply if the file changed

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
Patrick Uiterwijk 2018-04-19 17:35:26 +02:00
parent bb070496c3
commit 633c64b7d2

View file

@ -1,14 +1,18 @@
- name: Copy template {{template}} to temporary file ({{tmpfile.path}})
template: src={{roles_path}}/openshift-apps/{{app}}/templates/{{template}} dest=/etc/openshift_apps/{{app}}/{{objectname}}
when: template is defined
register: object_template
- name: Copy template {{template_fullpath}} to temporary file ({{tmpfile.path}})
template: src={{template_fullpath}} dest=/etc/openshift_apps/{{app}}/{{objectname}}
when: template_fullpath is defined and template is not defined
register: object_template_fullpath
- name: Copy file {{file}} to temporary file ({{tmpfile.path}})
copy: src={{roles_path}}/openshift-apps/{{app}}/files/{{file}} dest=/etc/openshift_apps/{{app}}/{{objectname}}
when: file is defined and template is not defined and template_fullpath is not defined
register: object_file
- name: Call `oc apply` on the copied file
shell: oc -n {{app}} apply -f /etc/openshift_apps/{{app}}/{{objectname}}
when: object_template.changed or object_template_fullpath.changed or object_file.changed