From e9cdc5d8c4071b7fdaae67ca92ab9c3245d1d940 Mon Sep 17 00:00:00 2001 From: Kirill Klenov Date: Tue, 11 Jun 2024 10:26:33 +0300 Subject: [PATCH] feat: wip --- defaults/main.yml | 3 +++ tasks/run.yml | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index b807e84..2d1d485 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -17,3 +17,6 @@ docker_run_copy: [] # Run Docker Containers docker_run_containers: [] + +# Container defaults +docker_run_defaults: {} diff --git a/tasks/run.yml b/tasks/run.yml index a09b928..891bd17 100644 --- a/tasks/run.yml +++ b/tasks/run.yml @@ -52,12 +52,12 @@ links: "{{ item.links|default(omit) }}" name: "{{ item.name|default(item) }}" network_mode: "{{ item.network_mode|default(omit) }}" - networks: "{{ item.networks|default(omit) }}" + networks: "{{ item.networks|default(docker_run_defaults.networks)|default(omit) }}" ports: "{{ item.ports|default(omit) }}" pull: "{{ item.pull|default(true) }}" recreate: "{{ item.recreate|default(omit) }}" restart: "{{ item.restart|default(omit) }}" - restart_policy: "{{ item.restart_policy|default(omit) }}" + restart_policy: "{{ item.restart_policy|default(docker_run_defaults.restart_policy)|default(omit) }}" state: "{{ item.state|default(omit) }}" timeout: "{{ item.timeout|default(omit) }}" tty: "{{ item.tty|default(omit) }}"