ansible-role-swarm/tasks/config.yml

31 lines
1 KiB
YAML
Raw Normal View History

2019-08-24 10:55:56 +00:00
---
- name: manage networks
2021-11-22 10:28:13 +00:00
community.docker.docker_network:
name: '{{ item.key }}'
driver: '{{ item.value.driver|default("bridge") }}'
2019-08-24 10:55:56 +00:00
scope: swarm
state: '{{ item.value.state|default("present") }}'
2021-11-22 11:02:26 +00:00
loop: '{{ swarm_networks|dict2items }}'
loop_control:
label: '{{ item.key }}'
2021-11-22 10:43:06 +00:00
tags: swarm
2019-08-24 10:55:56 +00:00
- name: manage services
2021-11-22 10:28:13 +00:00
community.docker.docker_swarm_service:
name: '{{ item.key }}'
image: '{{ item.value.image }}'
command: '{{ item.value.command|default([]) }}'
args: '{{ item.value.args|default([]) }}'
mounts: '{{ item.value.mounts|default([]) }}'
networks: '{{ item.value.networks|default([]) }}'
publish: '{{ item.value.publish|default([]) }}'
replicas: '{{ item.value.replicas|default(1) }}'
limits: '{{ item.value.limits|default({}) }}'
env: '{{ item.value.env|default({}) }}'
container_labels: '{{ item.value.labels|default({}) }}'
state: '{{ item.value.state|default("present") }}'
2021-11-22 11:02:26 +00:00
loop: '{{ swarm_services|dict2items }}'
2021-11-22 10:47:20 +00:00
loop_control:
label: '{{ item.key }}'
2021-11-22 10:43:06 +00:00
tags: swarm