ansible-role-docker-swarm/tasks/portainer.yml

20 lines
681 B
YAML

---
- name: Manage the installation of portainer as a stack
block:
- name: Create a directory for the portainer stack
file: dest=/srv/portainer state=directory mode='0755'
- name: Install the portainer docker stack configuration
template: src=portainer-agent-stack.yml.j2 dest=/srv/portainer/portainer-agent-stack.yml owner=root group=root mode='0444'
- name: Run the docker stack to start portainer
docker_stack:
state: present
name: portainer
compose:
- /srv/portainer/portainer-agent-stack.yml
run_once: True
when: docker_swarm_manager_main_node | bool
tags: [ 'portainer', 'docker_portainer', 'docker_swarm', 'docker' ]