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

89 lines
2.1 KiB
Plaintext
Raw Normal View History

2023-05-29 13:26:35 +02:00
version: '3.8'
2020-09-30 17:14:29 +02:00
volumes:
2022-10-31 20:01:13 +01:00
portainer_server_data:
{% if docker_swarm_portainer_nfs_volume %}
2022-11-01 18:50:49 +01:00
driver: local
driver_opts:
type: {{ docker_swarm_portainer_nfs_type }}
# o: "nfsvers=4,addr=146.48.123.250,rw,nolock,soft"
o: "{{ docker_swarm_portainer_nfs_o }}"
device: "{{ docker_swarm_portainer_nfs_device }}"
{% endif %}
2022-10-31 20:01:13 +01:00
networks:
2023-05-26 16:27:39 +02:00
{% if docker_swarm_cluster_haproxy_install %}
{{ haproxy_docker_overlay_network }}:
external: true
2023-05-26 16:27:39 +02:00
{% endif %}
{{ docker_swarm_portainer_network }}:
2020-09-30 17:14:29 +02:00
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 }}
2020-09-30 17:14:29 +02:00
{% if docker_log_to_journal %}
logging:
driver: 'journald'
2020-09-30 17:14:29 +02:00
{% endif %}
portainer:
image: portainer/portainer-ce
command: -H tcp://tasks.agent:9001 --tlsskipverify
2023-05-26 18:06:54 +02:00
{% if not docker_swarm_cluster_haproxy_install %}
2023-05-26 16:27:39 +02:00
ports:
- target: 9443
published: 9443
protocol: tcp
mode: 'ingress'
- target: 9000
published: 9000
protocol: tcp
mode: 'ingress'
- target: 8000
published: 8000
protocol: tcp
mode: 'ingress'
2023-05-26 16:27:39 +02:00
{% endif %}
2020-09-30 17:14:29 +02:00
volumes:
2022-10-31 20:01:13 +01:00
- portainer_server_data:/data
networks:
- {{ docker_swarm_portainer_network }}
2023-05-26 18:08:42 +02:00
{% if docker_swarm_cluster_haproxy_install %}
2023-05-26 16:27:39 +02:00
- {{ haproxy_docker_overlay_network }}
2023-05-26 16:27:39 +02:00
{% endif %}
2020-09-30 17:14:29 +02:00
deploy:
mode: replicated
replicas: 1
{% if docker_swarm_cluster_haproxy_install %}
2020-09-30 17:14:29 +02:00
endpoint_mode: dnsrr
{% endif %}
2020-09-30 17:14:29 +02:00
restart_policy:
2020-10-01 18:36:33 +02:00
condition: on-failure
2020-09-30 17:14:29 +02:00
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'
2020-09-30 17:14:29 +02:00
{% endif %}