2022-06-06 22:43:02 +00:00
|
|
|
---
|
2022-06-07 13:43:09 +00:00
|
|
|
# Installs Portainer or portainer agent for Docker management
|
2022-06-06 22:43:02 +00:00
|
|
|
- name: Deploy Portainer
|
|
|
|
community.docker.docker_container:
|
|
|
|
name: portainer
|
2022-06-07 13:43:09 +00:00
|
|
|
image: portainer/portainer-ce
|
|
|
|
restart_policy: always
|
2022-06-06 22:43:02 +00:00
|
|
|
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
|
2022-06-15 01:42:58 +00:00
|
|
|
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
|
2022-06-06 22:43:02 +00:00
|
|
|
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-06 22:43:02 +00:00
|
|
|
|
2022-06-07 13:43:09 +00:00
|
|
|
# Install Watchtower to auto update containers. Checks every 4 hours
|
2022-06-06 22:43:02 +00:00
|
|
|
- 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 * * *"
|
2022-07-05 23:09:43 +00:00
|
|
|
env:
|
|
|
|
- "TZ={{ TZ }}"
|
|
|
|
- WATCHTOWER_CLEANUP=true
|
2022-06-06 22:43:02 +00:00
|
|
|
volumes:
|
|
|
|
- /var/run/docker.sock:/var/run/docker.sock
|