2019-08-24 10:55:56 +00:00
|
|
|
---
|
2023-11-23 10:12:18 +00:00
|
|
|
- name: Copy registry login
|
2021-11-23 15:43:51 +00:00
|
|
|
community.general.docker_login:
|
|
|
|
registry_url: '{{ item.value.registry_url }}'
|
|
|
|
username: '{{ item.value.registry_username }}'
|
|
|
|
password: '{{ item.value.registry_password }}'
|
|
|
|
become: true
|
2022-07-20 09:53:28 +00:00
|
|
|
become_user: '{{ item.value.user | default(ansible_user_id) }}'
|
|
|
|
loop: '{{ swarm_registry_logins | dict2items }}'
|
2021-11-23 15:43:51 +00:00
|
|
|
loop_control:
|
|
|
|
label: '{{ item.key }}'
|
|
|
|
tags: swarm
|
|
|
|
|
2023-11-23 10:12:18 +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 }}'
|
2023-11-23 10:12:18 +00:00
|
|
|
driver: '{{ item.value.driver | default("overlay") }}'
|
2019-08-24 10:55:56 +00:00
|
|
|
scope: swarm
|
2022-07-20 09:53:28 +00:00
|
|
|
state: '{{ item.value.state | default("present") }}'
|
|
|
|
loop: '{{ swarm_networks | dict2items }}'
|
2021-11-22 10:56:01 +00:00
|
|
|
loop_control:
|
|
|
|
label: '{{ item.key }}'
|
2022-06-27 13:54:51 +00:00
|
|
|
when: swarm_manager
|
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
|
|
|
|
2023-11-23 10:12:18 +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 }}'
|
2022-07-20 09:53:28 +00:00
|
|
|
command: '{{ item.value.command | default([]) }}'
|
|
|
|
hostname: '{{ item.value.hostname | default(omit) }}'
|
|
|
|
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({}) }}'
|
2023-12-15 10:36:55 +00:00
|
|
|
init: '{{ item.value.init | default(omit) }}'
|
2022-07-20 09:53:28 +00:00
|
|
|
state: '{{ item.value.state | default("present") }}'
|
|
|
|
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 }}'
|
2022-06-27 13:54:51 +00:00
|
|
|
when: swarm_manager
|
2021-11-22 13:38:49 +00:00
|
|
|
run_once: true
|
2021-11-22 10:43:06 +00:00
|
|
|
tags: swarm
|