infra-v1/applications/roles/base/tasks/containers.yml

35 lines
1013 B
YAML
Raw Normal View History

---
2022-06-07 13:43:09 +00:00
# Installs Portainer or portainer agent for Docker management
- name: Deploy Portainer
community.docker.docker_container:
name: portainer
2022-06-07 13:43:09 +00:00
image: portainer/portainer-ce
restart_policy: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
2022-06-07 13:43:09 +00:00
- portainer_data:/data
ports:
- 9000:9000
- 8000:8000
when: "'home-apps' in group_names"
2022-06-07 13:43:09 +00:00
- name: Deploy Portainer Agent
community.docker.docker_container:
name: portainer-agent
image: portainer/agent
restart_policy: always
2022-06-07 13:43:09 +00:00
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/volumes:/var/lib/docker/volumes
when: "'docker-main' not in group_names"
2022-06-07 13:43:09 +00:00
# Install Watchtower to auto update containers. Checks every 4 hours
- name: Deploy Watchtower
community.docker.docker_container:
name: watchtower
image: containrrr/watchtower
2022-06-07 13:43:09 +00:00
restart_policy: always
command: --schedule "0 0 4 * * *"
volumes:
- /var/run/docker.sock:/var/run/docker.sock