containerRestart1
This commit is contained in:
		
							parent
							
								
									eb0372ded4
								
							
						
					
					
						commit
						24d69d8d66
					
				@ -81,6 +81,10 @@
 | 
			
		||||
  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
 | 
			
		||||
 | 
			
		||||
  #Copy templates form a generic dir, allow ansible to search
 | 
			
		||||
- name: "Generic template mappings for {{ container_Name }}"
 | 
			
		||||
@ -93,6 +97,10 @@
 | 
			
		||||
  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
 | 
			
		||||
 | 
			
		||||
- name: Append templated files to the mapping list
 | 
			
		||||
  set_fact:
 | 
			
		||||
@ -135,6 +143,10 @@
 | 
			
		||||
  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
 | 
			
		||||
#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
 | 
			
		||||
@ -146,6 +158,11 @@
 | 
			
		||||
  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
 | 
			
		||||
 | 
			
		||||
#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
 | 
			
		||||
@ -157,6 +174,10 @@
 | 
			
		||||
  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
 | 
			
		||||
 | 
			
		||||
- name: Append static remote files to the mapping list
 | 
			
		||||
  set_fact:
 | 
			
		||||
@ -199,6 +220,12 @@
 | 
			
		||||
  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----------------------------------
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -215,8 +242,9 @@
 | 
			
		||||
#----------------------------------/Check ENV----------------------------------
 | 
			
		||||
 | 
			
		||||
- name: Restart the container if fileChanged is defined
 | 
			
		||||
  set_fact: item.value.restart='yes'
 | 
			
		||||
  when: fileChanged is defined
 | 
			
		||||
  set_fact: containerRestart1='yes'
 | 
			
		||||
  when: (containerRestart is defined and containerRestart=='yes') or (item.value.restart is defined and item.value.restart =='yes')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
- name: "Container {{ container_Name }}"
 | 
			
		||||
@ -229,7 +257,7 @@
 | 
			
		||||
    recreate: "{{ item.value.recreate | default('false') }}"
 | 
			
		||||
    image: "{{ item.value.image }}"
 | 
			
		||||
    state: "{{ item.value.start | default ('started') }}"
 | 
			
		||||
    restart: "{{ item.value.restart | default ('no') }}"
 | 
			
		||||
    restart: "{{ containerRestart1 | default ('no') }}"
 | 
			
		||||
    restart_policy: "{{ item.value.restart_policy | default ('always') }}"
 | 
			
		||||
    purge_networks: "{{ item.value.purge_networks | default ('yes') }}"
 | 
			
		||||
    networks: "{{ net_checked }}"
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user