diff --git a/dockerContainer.yml b/dockerContainer.yml index 75c64e3..1ec6d7d 100644 --- a/dockerContainer.yml +++ b/dockerContainer.yml @@ -56,6 +56,7 @@ + #----------------------------------TEMPLATES---------------------------------- #Only copy template files if there are templates defined in the incoming defintion dict - set_fact: templates_Defined=0 @@ -79,13 +80,9 @@ loop_control: loop_var: outer_item when: templates_Defined ==1 and outer_item.value.generic is not defined - register: fileChanged tags: always -- name: Set the flag to restart the container if file was changed - set_fact: containerRestart='yes' - when: fileChanged is defined and fileChanged.changed - tags: always - + register: regular_template + notify: Restart container #Copy templates form a generic dir, allow ansible to search - name: "Generic template mappings for {{ container_Name }}" #Files will be copied to the 'config' dir as defined by container_configDir, they will be stored using their template file name but with the '.j2' stripped @@ -95,13 +92,9 @@ loop_control: loop_var: outer_item when: templates_Defined ==1 and outer_item.value.generic is defined - register: fileChanged tags: always -- name: Set the flag to restart the container if file was changed - set_fact: containerRestart='yes' - when: fileChanged is defined and fileChanged.changed - tags: always - + register: generic_template + notify: Restart container - name: Append templated files to the mapping list set_fact: #build a list to pass to docker containing the source of the file(As on disk on the host) and the destination mount within the container @@ -141,12 +134,9 @@ loop_control: loop_var: outer_item when: files_Defined == 1 and outer_item.value.generic is not defined and outer_item.value.src_text is not defined - register: fileChanged - tags: always -- name: Set the flag to restart the container if file was changed - set_fact: containerRestart='yes' - when: fileChanged is defined and fileChanged.changed tags: always + register: file_copy + notify: Restart container #Copy files from a generic dir, allow ansible to search - name: "Generic File mappings for {{ container_Name }}" #Files will be copied to the 'config' dir as defined by container_configDir, they will be stored using their file name @@ -156,13 +146,9 @@ loop_control: loop_var: outer_item when: files_Defined == 1 and outer_item.value.generic is defined and outer_item.value.src_text is not defined - register: fileChanged tags: always -- name: Set the flag to restart the container if file was changed - set_fact: containerRestart='yes' - when: fileChanged is defined and fileChanged.changed - tags: always - + register: generic_copy + notify: Restart container #Create files based on the suplied src_text param - name: "Text based file creation for {{ container_Name }}" #Files will be copied to the 'config' dir as defined by container_configDir, they will be stored using their file name @@ -172,12 +158,9 @@ loop_control: loop_var: outer_item when: files_Defined == 1 and outer_item.value.src_text is defined - register: fileChanged - tags: always -- name: Set the flag to restart the container if file was changed - set_fact: containerRestart='yes' - when: fileChanged is defined and fileChanged.changed tags: always + register: text_copy + notify: Restart container - name: Append static remote files to the mapping list set_fact: @@ -218,14 +201,7 @@ loop_control: loop_var: outer_item when: local_Defined == 1 - register: fileChanged tags: always - -- name: Set the flag to restart the container if file was changed - set_fact: containerRestart='yes' - when: fileChanged is defined and fileChanged.changed - tags: always - #----------------------------------/LOCAL---------------------------------- @@ -280,3 +256,4 @@ # fluentd-sub-second-precision: true # tag: myservice tags: always + diff --git a/dockerVolume.yml b/dockerVolume.yml index 7e53fec..61f3378 100644 --- a/dockerVolume.yml +++ b/dockerVolume.yml @@ -1,7 +1,7 @@ -#- name: "Checking docker volume {{working_volume_name}}" +# - name: "Checking docker volume {{working_volume_name}}" # debug: msg="Checking docker volume {{working_volume_name}}" -#----------------------------------Local Volume---------------------------------- +# ----------------------------------Local Volume---------------------------------- - set_fact: base_volume_name="local_" tags: always