Compare commits
10 Commits
4f62020d89
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| a99dbaee07 | |||
| f0a6a7d51a | |||
| 3c2d85f480 | |||
| 56beaa8208 | |||
| 7016ab2464 | |||
| 032cc44c2b | |||
| 24d69d8d66 | |||
| eb0372ded4 | |||
| 8654f76936 | |||
| db4c4fbefd |
+62
-13
@@ -56,6 +56,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------TEMPLATES----------------------------------
|
#----------------------------------TEMPLATES----------------------------------
|
||||||
#Only copy template files if there are templates defined in the incoming defintion dict
|
#Only copy template files if there are templates defined in the incoming defintion dict
|
||||||
- set_fact: templates_Defined=0
|
- set_fact: templates_Defined=0
|
||||||
@@ -80,7 +81,8 @@
|
|||||||
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
|
||||||
tags: always
|
tags: always
|
||||||
|
register: regular_template
|
||||||
|
notify: Restart container
|
||||||
#Copy templates form a generic dir, allow ansible to search
|
#Copy templates form a generic dir, allow ansible to search
|
||||||
- name: "Generic template mappings for {{ container_Name }}"
|
- 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
|
#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
|
||||||
@@ -91,7 +93,8 @@
|
|||||||
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
|
||||||
tags: always
|
tags: always
|
||||||
|
register: generic_template
|
||||||
|
notify: Restart container
|
||||||
- name: Append templated files to the mapping list
|
- name: Append templated files to the mapping list
|
||||||
set_fact:
|
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
|
#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
|
||||||
@@ -132,6 +135,8 @@
|
|||||||
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
|
||||||
tags: always
|
tags: always
|
||||||
|
register: file_copy
|
||||||
|
notify: Restart container
|
||||||
#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 }}"
|
||||||
#Files will be copied to the 'config' dir as defined by container_configDir, they will be stored using their file name
|
#Files will be copied to the 'config' dir as defined by container_configDir, they will be stored using their file name
|
||||||
@@ -142,6 +147,8 @@
|
|||||||
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
|
||||||
tags: always
|
tags: always
|
||||||
|
register: generic_copy
|
||||||
|
notify: Restart container
|
||||||
#Create files based on the suplied src_text param
|
#Create files based on the suplied src_text param
|
||||||
- name: "Text based file creation for {{ container_Name }}"
|
- 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
|
#Files will be copied to the 'config' dir as defined by container_configDir, they will be stored using their file name
|
||||||
@@ -152,6 +159,8 @@
|
|||||||
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
|
||||||
tags: always
|
tags: always
|
||||||
|
register: text_copy
|
||||||
|
notify: Restart container
|
||||||
|
|
||||||
- name: Append static remote files to the mapping list
|
- name: Append static remote files to the mapping list
|
||||||
set_fact:
|
set_fact:
|
||||||
@@ -208,12 +217,9 @@
|
|||||||
tags: always
|
tags: always
|
||||||
#----------------------------------/Check ENV----------------------------------
|
#----------------------------------/Check ENV----------------------------------
|
||||||
|
|
||||||
|
- name: Setup default values for this container
|
||||||
#TODO - If a confile file or volume is changed, trestart the container
|
set_fact:
|
||||||
|
default:
|
||||||
- name: "Container {{ container_Name }}"
|
|
||||||
become: yes
|
|
||||||
docker_container:
|
|
||||||
name: "{{ container_Name }}"
|
name: "{{ container_Name }}"
|
||||||
hostname: "{{ item.value.hostname | default(container_Name) }}"
|
hostname: "{{ item.value.hostname | default(container_Name) }}"
|
||||||
command: "{{ item.value.command | default('') }}"
|
command: "{{ item.value.command | default('') }}"
|
||||||
@@ -231,9 +237,52 @@
|
|||||||
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
|
|
||||||
#"{{item.value.ports | default ([json-file])}}"
|
|
||||||
#log_options:
|
|
||||||
# fluentd-sub-second-precision: true
|
|
||||||
# tag: myservice
|
|
||||||
tags: always
|
tags: always
|
||||||
|
|
||||||
|
- name: Setup devices_override blank
|
||||||
|
set_fact:
|
||||||
|
devices_override:
|
||||||
|
tags: always
|
||||||
|
|
||||||
|
- name: Setup ulimit_override blank
|
||||||
|
set_fact:
|
||||||
|
ulimit_override:
|
||||||
|
tags: always
|
||||||
|
|
||||||
|
#----------Merge ulimits--------------
|
||||||
|
- name: Apply conditional override
|
||||||
|
set_fact:
|
||||||
|
ulimit_override:
|
||||||
|
ulimits: "{{ item.value.ulimits }}"
|
||||||
|
when: item.value.ulimits is defined
|
||||||
|
tags: always
|
||||||
|
|
||||||
|
- name: Merge the two lists
|
||||||
|
set_fact:
|
||||||
|
ulimits_merged: "{{ default | combine(ulimit_override, recursive=true) }}"
|
||||||
|
tags: always
|
||||||
|
|
||||||
|
#----------Merge devices--------------
|
||||||
|
- name: Apply conditional override
|
||||||
|
set_fact:
|
||||||
|
devices_override:
|
||||||
|
devices: "{{ item.value.devices }}"
|
||||||
|
when: item.value.devices is defined
|
||||||
|
tags: always
|
||||||
|
|
||||||
|
- name: Merge the two lists
|
||||||
|
set_fact:
|
||||||
|
final_merged: "{{ ulimits_merged | combine(devices_override, recursive=true) }}"
|
||||||
|
tags: always
|
||||||
|
|
||||||
|
- name: debug value
|
||||||
|
debug:
|
||||||
|
msg: "{{final_merged}}"
|
||||||
|
tags: always
|
||||||
|
|
||||||
|
- name: "Container {{ container_Name }}"
|
||||||
|
become: true
|
||||||
|
docker_container: "{{ final_merged }}"
|
||||||
|
tags: always
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -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}}"
|
# debug: msg="Checking docker volume {{working_volume_name}}"
|
||||||
|
|
||||||
#----------------------------------Local Volume----------------------------------
|
# ----------------------------------Local Volume----------------------------------
|
||||||
|
|
||||||
- set_fact: base_volume_name="local_"
|
- set_fact: base_volume_name="local_"
|
||||||
tags: always
|
tags: always
|
||||||
|
|||||||
Reference in New Issue
Block a user