Compare commits
No commits in common. "1b95015c0fe74d572ee60bdfde3d2522c1efa225" and "a99dbaee0723324f7f67bb6930f70d41d7f87aa7" have entirely different histories.
1b95015c0f
...
a99dbaee07
|
@ -217,43 +217,72 @@
|
||||||
tags: always
|
tags: always
|
||||||
#----------------------------------/Check ENV----------------------------------
|
#----------------------------------/Check ENV----------------------------------
|
||||||
|
|
||||||
- name: Restart the container if fileChanged is defined
|
- name: Setup default values for this container
|
||||||
set_fact: containerRestart1='yes'
|
set_fact:
|
||||||
when: (containerRestart is defined and containerRestart=='yes') or (item.value.restart is defined and item.value.restart =='yes')
|
default:
|
||||||
|
name: "{{ container_Name }}"
|
||||||
|
hostname: "{{ item.value.hostname | default(container_Name) }}"
|
||||||
|
command: "{{ item.value.command | default('') }}"
|
||||||
|
pull: "{{ item.value.pull | default('false') }}"
|
||||||
|
recreate: "{{ item.value.recreate | default('false') }}"
|
||||||
|
image: "{{ item.value.image }}"
|
||||||
|
state: "{{ item.value.start | default ('started') }}"
|
||||||
|
restart: "{{ item.value.restart | default ('no') }}"
|
||||||
|
restart_policy: "{{ item.value.restart_policy | default ('always') }}"
|
||||||
|
purge_networks: "{{ item.value.purge_networks | default ('yes') }}"
|
||||||
|
networks: "{{ net_checked }}"
|
||||||
|
volumes: "{{ mappings }}"
|
||||||
|
env: "{{ env_checked }}"
|
||||||
|
privileged: "{{ item.value.privileged | default ('no') }}"
|
||||||
|
network_mode: "{{ item.value.network_mode | default ('default') }}"
|
||||||
|
shm_size: "{{ item.value.shm_size | default ('64M') }}"
|
||||||
|
ports: "{{ item.value.ports | default ([]) }}"
|
||||||
|
|
||||||
|
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 }}"
|
- name: "Container {{ container_Name }}"
|
||||||
become: yes
|
become: true
|
||||||
docker_container:
|
docker_container: "{{ final_merged }}"
|
||||||
name: "{{ container_Name }}"
|
|
||||||
hostname: "{{ item.value.hostname | default(container_Name) }}"
|
|
||||||
command: "{{ item.value.command | default('') }}"
|
|
||||||
pull: "{{ item.value.pull | default('false') }}"
|
|
||||||
recreate: "{{ item.value.recreate | default('false') }}"
|
|
||||||
image: "{{ item.value.image }}"
|
|
||||||
state: "{{ item.value.start | default ('started') }}"
|
|
||||||
restart: "{{ containerRestart1 | default ('no') }}"
|
|
||||||
restart_policy: "{{ item.value.restart_policy | default ('always') }}"
|
|
||||||
purge_networks: "{{ item.value.purge_networks | default ('yes') }}"
|
|
||||||
networks: "{{ net_checked }}"
|
|
||||||
volumes: "{{ mappings }}"
|
|
||||||
env: "{{ env_checked }}"
|
|
||||||
privileged: "{{ item.value.privileged | default ('no') }}"
|
|
||||||
network_mode: "{{ item.value.network_mode | default ('default') }}"
|
|
||||||
shm_size: "{{ item.value.shm_size | default ('64M') }}"
|
|
||||||
ports: "{{ item.value.ports | default ([]) }}"
|
|
||||||
cpu_period: "{{ item.value.cpu_period | default(0) }}"
|
|
||||||
cpu_quota: "{{ item.value.cpu_quota | default(0) }}"
|
|
||||||
cpu_shares: "{{ item.value.cpu_shares | default(0) }}"
|
|
||||||
cpus: "{{ item.value.cpus | default(0) }}"
|
|
||||||
cpuset_cpus: "{{ item.value.cpuset_cpus | default('') }}"
|
|
||||||
mem_limit: "{{ item.value.mem_limit | default(0) }}"
|
|
||||||
mem_reservation: "{{ item.value.mem_reservation | default(0) }}"
|
|
||||||
#log_driver: fluentd
|
|
||||||
#"{{item.value.ports | default ([json-file])}}"
|
|
||||||
#log_options:
|
|
||||||
# fluentd-sub-second-precision: true
|
|
||||||
# tag: myservice
|
|
||||||
tags: always
|
tags: always
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue