Compare commits

...

2 Commits

Author SHA1 Message Date
Cory Hawkless 7016ab2464 Upd 2022-10-10 14:40:59 +10:30
Cory Hawkless 032cc44c2b Upd 2022-10-10 14:39:36 +10:30
2 changed files with 45 additions and 54 deletions

View File

@ -79,11 +79,11 @@
loop_control: loop_control:
loop_var: outer_item loop_var: outer_item
when: templates_Defined ==1 and outer_item.value.generic is not defined when: templates_Defined ==1 and outer_item.value.generic is not defined
register: fileChanged register: file_changed
tags: always tags: always
- name: Set the flag to restart the container if file was changed - name: Set the flag to restart the container if file was changed
set_fact: containerRestart='yes' set_fact: container_restart='yes'
when: fileChanged is defined and fileChanged.changed when: file_changed is defined and file_changed.changed
tags: always tags: always
#Copy templates form a generic dir, allow ansible to search #Copy templates form a generic dir, allow ansible to search
@ -95,11 +95,11 @@
loop_control: loop_control:
loop_var: outer_item loop_var: outer_item
when: templates_Defined ==1 and outer_item.value.generic is defined when: templates_Defined ==1 and outer_item.value.generic is defined
register: fileChanged register: file_changed
tags: always tags: always
- name: Set the flag to restart the container if file was changed - name: Set the flag to restart the container if file was changed
set_fact: containerRestart='yes' set_fact: container_restart='yes'
when: fileChanged is defined and fileChanged.changed when: file_changed is defined and file_changed.changed
tags: always tags: always
- name: Append templated files to the mapping list - name: Append templated files to the mapping list
@ -141,11 +141,11 @@
loop_control: loop_control:
loop_var: outer_item 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 when: files_Defined == 1 and outer_item.value.generic is not defined and outer_item.value.src_text is not defined
register: fileChanged register: file_changed
tags: always tags: always
- name: Set the flag to restart the container if file was changed - name: Set the flag to restart the container if file was changed
set_fact: containerRestart='yes' set_fact: container_restart='yes'
when: fileChanged is defined and fileChanged.changed when: file_changed is defined and file_changed.changed
tags: always tags: always
#Copy files from a generic dir, allow ansible to search #Copy files from a generic dir, allow ansible to search
- name: "Generic File mappings for {{ container_Name }}" - name: "Generic File mappings for {{ container_Name }}"
@ -156,11 +156,11 @@
loop_control: loop_control:
loop_var: outer_item loop_var: outer_item
when: files_Defined == 1 and outer_item.value.generic is defined and outer_item.value.src_text is not defined when: files_Defined == 1 and outer_item.value.generic is defined and outer_item.value.src_text is not defined
register: fileChanged register: file_changed
tags: always tags: always
- name: Set the flag to restart the container if file was changed - name: Set the flag to restart the container if file was changed
set_fact: containerRestart='yes' set_fact: container_restart='yes'
when: fileChanged is defined and fileChanged.changed when: file_changed is defined and file_changed.changed
tags: always tags: always
# Create files based on the suplied src_text param # Create files based on the suplied src_text param
@ -172,11 +172,11 @@
loop_control: loop_control:
loop_var: outer_item loop_var: outer_item
when: files_Defined == 1 and outer_item.value.src_text is defined when: files_Defined == 1 and outer_item.value.src_text is defined
register: fileChanged register: file_changed
tags: always tags: always
- name: Set the flag to restart the container if file was changed - name: Set the flag to restart the container if file was changed
set_fact: containerRestart='yes' set_fact: container_restart='yes'
when: fileChanged is defined and fileChanged.changed when: file_changed is defined and file_changed.changed
tags: always tags: always
- name: Append static remote files to the mapping list - name: Append static remote files to the mapping list
@ -191,9 +191,6 @@
tags: always tags: always
# ----------------------------------/FILES---------------------------------- # ----------------------------------/FILES----------------------------------
# ----------------------------------LOCAL---------------------------------- # ----------------------------------LOCAL----------------------------------
# Local files alreeady exist on the host, commonly local time and or netns for namespace, could also be locl disk drives? # Local files alreeady exist on the host, commonly local time and or netns for namespace, could also be locl disk drives?
# Nothing gets copied for local mappings, just defintiions added to the mapping list # Nothing gets copied for local mappings, just defintiions added to the mapping list
@ -218,12 +215,12 @@
loop_control: loop_control:
loop_var: outer_item loop_var: outer_item
when: local_Defined == 1 when: local_Defined == 1
register: fileChanged register: file_changed
tags: always tags: always
- name: Set the flag to restart the container if file was changed - name: Set the flag to restart the container if file was changed
set_fact: containerRestart='yes' set_fact: container_restart='yes'
when: fileChanged is defined and fileChanged.changed when: file_changed is defined and file_changed.changed
tags: always tags: always
# ----------------------------------/LOCAL---------------------------------- # ----------------------------------/LOCAL----------------------------------
@ -241,14 +238,12 @@
tags: always tags: always
# ----------------------------------/Check ENV---------------------------------- # ----------------------------------/Check ENV----------------------------------
- name: Restart the container if fileChanged is defined - name: Restart the container if file_changed is defined
set_fact: containerRestart1='yes' set_fact: container_restart1='yes'
when: (containerRestart is defined and containerRestart=='yes') or (item.value.restart is defined and item.value.restart =='yes') when: (container_restart is defined and container_restart=='yes') or (item.value.restart is defined and item.value.restart =='yes')
- name: "Container {{ container_Name }}" - name: "Container {{ container_Name }}"
become: yes become: true
docker_container: docker_container:
name: "{{ container_Name }}" name: "{{ container_Name }}"
hostname: "{{ item.value.hostname | default(container_Name) }}" hostname: "{{ item.value.hostname | default(container_Name) }}"
@ -257,7 +252,7 @@
recreate: "{{ item.value.recreate | default('false') }}" recreate: "{{ item.value.recreate | default('false') }}"
image: "{{ item.value.image }}" image: "{{ item.value.image }}"
state: "{{ item.value.start | default ('started') }}" state: "{{ item.value.start | default ('started') }}"
restart: "{{ containerRestart1 | default ('no') }}" restart: "{{ container_restart1 | default ('no') }}"
restart_policy: "{{ item.value.restart_policy | default ('always') }}" restart_policy: "{{ item.value.restart_policy | default ('always') }}"
purge_networks: "{{ item.value.purge_networks | default ('yes') }}" purge_networks: "{{ item.value.purge_networks | default ('yes') }}"
networks: "{{ net_checked }}" networks: "{{ net_checked }}"
@ -267,9 +262,5 @@
network_mode: "{{ item.value.network_mode | default ('default') }}" network_mode: "{{ item.value.network_mode | default ('default') }}"
shm_size: "{{ item.value.shm_size | default ('64M') }}" shm_size: "{{ item.value.shm_size | default ('64M') }}"
ports: "{{ item.value.ports | default ([]) }}" ports: "{{ item.value.ports | default ([]) }}"
#log_driver: fluentd ulimits: "{{ item.value.ulimits | default ('') }}"
#"{{item.value.ports | default ([json-file])}}"
#log_options:
# fluentd-sub-second-precision: true
# tag: myservice
tags: always tags: always