2019-08-24 10:55:56 +00:00
|
|
|
---
|
2021-11-23 15:43:51 +00:00
|
|
|
- name: copy registry login
|
|
|
|
community.general.docker_login:
|
|
|
|
registry_url: '{{ item.value.registry_url }}'
|
|
|
|
username: '{{ item.value.registry_username }}'
|
|
|
|
password: '{{ item.value.registry_password }}'
|
|
|
|
become: true
|
|
|
|
become_user: '{{ item.value.user|default(ansible_user_id) }}'
|
|
|
|
loop: '{{ swarm_registry_logins|dict2items }}'
|
|
|
|
loop_control:
|
|
|
|
label: '{{ item.key }}'
|
|
|
|
tags: swarm
|
|
|
|
|
2019-08-24 10:55:56 +00:00
|
|
|
- name: manage networks
|
2021-11-22 10:28:13 +00:00
|
|
|
community.docker.docker_network:
|
2021-11-22 10:56:01 +00:00
|
|
|
name: '{{ item.key }}'
|
|
|
|
driver: '{{ item.value.driver|default("bridge") }}'
|
2019-08-24 10:55:56 +00:00
|
|
|
scope: swarm
|
2021-11-22 10:56:01 +00:00
|
|
|
state: '{{ item.value.state|default("present") }}'
|
2021-11-22 11:02:26 +00:00
|
|
|
loop: '{{ swarm_networks|dict2items }}'
|
2021-11-22 10:56:01 +00:00
|
|
|
loop_control:
|
|
|
|
label: '{{ item.key }}'
|
2021-12-02 10:31:24 +00:00
|
|
|
run_once: true
|
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:
|
2021-11-22 10:56:01 +00:00
|
|
|
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:
|
2021-11-22 10:56:01 +00:00
|
|
|
label: '{{ item.key }}'
|
2021-11-22 13:38:49 +00:00
|
|
|
run_once: true
|
2021-11-22 10:43:06 +00:00
|
|
|
tags: swarm
|