From 633c64b7d28b3c87a4223c9ffdc8b7c61f146ecf Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Apr 19 2018 15:35:26 +0000 Subject: Only oc apply if the file changed Signed-off-by: Patrick Uiterwijk --- diff --git a/roles/openshift/object/tasks/main.yml b/roles/openshift/object/tasks/main.yml index 8ef392a..61270ae 100644 --- a/roles/openshift/object/tasks/main.yml +++ b/roles/openshift/object/tasks/main.yml @@ -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