ansible-role-docker-swarm/templates/portainer-agent-stack.yml.j2

55 lines
1.3 KiB
Django/Jinja

version: '3.2'
services:
agent:
image: portainer/agent
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/volumes:/var/lib/docker/volumes
deploy:
mode: global
placement:
constraints: [node.platform.os == linux]
networks:
- {{ docker_swarm_portainer_network }}
{% if docker_log_to_journal %}
logging:
driver: 'journald'
{% endif %}
portainer:
image: portainer/portainer-ce
command: -H tcp://tasks.agent:9001 --tlsskipverify
#ports:
# - "{{ docker_swarm_portainer_http_port }}:9000"
# - "{{ docker_swarm_portainer_service_port }}:8000"
volumes:
- portainer_data:/data
networks:
- {{ docker_swarm_portainer_network }}
deploy:
mode: replicated
replicas: 1
endpoint_mode: dnsrr
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
placement:
constraints:
- 'node.role == manager'
{% for constraint in docker_swarm_portainer_additional_constraints %}
- '{{ constraint }}'
{% endfor %}
{% if docker_log_to_journal %}
logging:
driver: 'journald'
{% endif %}
volumes:
portainer_data:
networks:
{{ docker_swarm_portainer_network }}: