christianlempa-boilerplates/ansible/deployment/portainer/deploy-portainer.yaml

22 lines
566 B
YAML

---
- name: Deploy portainer-ce latest
hosts: "{{ my_hosts | d([]) }}"
become: true
become_user: "{{ lookup('env','USER') }}"
tasks:
- name: Create new volume
community.docker.docker_volume:
name: portainer-data
- name: Deploy portainer
community.docker.docker_container:
name: portainer
image: "docker.io/portainer/portainer-ce"
ports:
- "9443:9443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer-data:/data
restart_policy: unless-stopped