Compare commits
2 Commits
a99dbaee07
...
1b95015c0f
Author | SHA1 | Date |
---|---|---|
Cory Hawkvelt | 1b95015c0f | |
Cory Hawkvelt | 58d4ca0cf7 |
|
@ -217,9 +217,15 @@
|
|||
tags: always
|
||||
#----------------------------------/Check ENV----------------------------------
|
||||
|
||||
- name: Setup default values for this container
|
||||
set_fact:
|
||||
default:
|
||||
- name: Restart the container if 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 }}"
|
||||
become: yes
|
||||
docker_container:
|
||||
name: "{{ container_Name }}"
|
||||
hostname: "{{ item.value.hostname | default(container_Name) }}"
|
||||
command: "{{ item.value.command | default('') }}"
|
||||
|
@ -227,7 +233,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 }}"
|
||||
|
@ -237,52 +243,17 @@
|
|||
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 }}"
|
||||
become: true
|
||||
docker_container: "{{ final_merged }}"
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue