--- - name: manage networks community.docker.docker_network: name: '{{ item.name }}' driver: '{{ item.driver|default("bridge") }}' scope: swarm state: '{{ item.state|default("present") }}' loop: '{{ swarm_networks }}' 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 }}' loop_control: label: '{{ item.name }}' tags: swarm