feat: swarm_services and swarm_networks are now hashs
This commit is contained in:
parent
8450009836
commit
62b98a3770
3 changed files with 25 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
swarm_manager: false
|
||||
swarm_advertise_addr: 127.0.0.1
|
||||
swarm_services: []
|
||||
swarm_networks: []
|
||||
swarm_services: {}
|
||||
swarm_networks: {}
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
vars:
|
||||
swarm_manager: true
|
||||
swarm_networks:
|
||||
- name: proxy
|
||||
proxy:
|
||||
swarm_services:
|
||||
- name: traefik
|
||||
traefik:
|
||||
image: traefik:1.7
|
||||
networks:
|
||||
- proxy
|
||||
|
@ -22,7 +22,7 @@
|
|||
mounts:
|
||||
- source: /var/run/docker.sock
|
||||
target: /var/run/docker.sock
|
||||
- name: whoami
|
||||
whoami:
|
||||
image: jwilder/whoami
|
||||
networks:
|
||||
- proxy
|
||||
|
|
|
@ -1,28 +1,30 @@
|
|||
---
|
||||
- name: manage networks
|
||||
community.docker.docker_network:
|
||||
name: '{{ item.name }}'
|
||||
driver: '{{ item.driver|default("bridge") }}'
|
||||
name: '{{ item.key }}'
|
||||
driver: '{{ item.value.driver|default("bridge") }}'
|
||||
scope: swarm
|
||||
state: '{{ item.state|default("present") }}'
|
||||
loop: '{{ swarm_networks }}'
|
||||
state: '{{ item.value.state|default("present") }}'
|
||||
loop: '{{ swarm_networks|dict2items() }}'
|
||||
loop_control:
|
||||
label: '{{ item.key }}'
|
||||
tags: swarm
|
||||
|
||||
- name: manage services
|
||||
community.docker.docker_swarm_service:
|
||||
name: '{{ item.name }}'
|
||||
image: '{{ item.image }}'
|
||||
command: '{{ item.command|default([]) }}'
|
||||
args: '{{ item.args|default([]) }}'
|
||||
mounts: '{{ item.mounts|default([]) }}'
|
||||
networks: '{{ item.networks|default([]) }}'
|
||||
publish: '{{ item.publish|default([]) }}'
|
||||
replicas: '{{ item.replicas|default(1) }}'
|
||||
limits: '{{ item.limits|default({}) }}'
|
||||
env: '{{ item.env|default({}) }}'
|
||||
container_labels: '{{ item.labels|default({}) }}'
|
||||
state: '{{ item.state|default("present") }}'
|
||||
loop: '{{ swarm_services }}'
|
||||
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") }}'
|
||||
loop: '{{ swarm_services|dict2items() }}'
|
||||
loop_control:
|
||||
label: '{{ item.name }}'
|
||||
label: '{{ item.key }}'
|
||||
tags: swarm
|
||||
|
|
Loading…
Reference in a new issue