--- - name: manage networks community.docker.docker_network: name: '{{ item.key }}' driver: '{{ item.value.driver|default("bridge") }}' scope: swarm 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.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.key }}' tags: swarm