portainer: the network creation has its own task

This commit is contained in:
Andrea Dell'Amico 2020-10-08 13:45:41 +02:00
parent b5caf21a6a
commit 5c110ab154
3 changed files with 7 additions and 6 deletions

View File

@ -17,7 +17,7 @@ docker_swarm_portainer_hostname: 'portainer-swarm.example.com'
docker_swarm_portainer_additional_constraints: []
# - 'node.hostname != docker01'
docker_swarm_portainer_network: 'agent_network'
docker_swarm_portainer_network: 'portainer_agent_network'
docker_swarm_portainer_http_port: '9000'
docker_swarm_portainer_service_port: '8000'

View File

@ -4,6 +4,12 @@
- name: Install the portainer docker stack configuration
template: src=portainer-agent-stack.yml.j2 dest=/srv/portainer-agent-stack.yml owner=root group=root mode='0444'
- name: Create the overlay network that will be used by portainer
docker_network:
name: '{{ docker_swarm_portainer_network }}'
driver: overlay
scope: swarm
- name: Run the docker stack to start portainer
docker_stack:
state: present

View File

@ -47,10 +47,5 @@ services:
driver: 'journald'
{% endif %}
networks:
{{ docker_swarm_portainer_network }}:
driver: overlay
attachable: true
volumes:
portainer_data: