This commit is contained in:
2024-05-06 15:20:57 +02:00
parent 6a2fbcee07
commit 1ef3dd3c83
21 changed files with 487 additions and 0 deletions

View File

@ -0,0 +1,6 @@
---
- name: Start Portainer
community.docker.docker_compose:
project_src: /home/ubuntu/docker-compose/portainer
state: present
restarted: true

View File

@ -0,0 +1,34 @@
---
- name: Ensure docker-compose is installed
ansible.builtin.package:
name: docker-compose
state: present
- name: Ensure Docker service is running
ansible.builtin.service:
name: docker
state: started
enabled: true
- name: Setup Portainer directory
ansible.builtin.file:
path: /home/ubuntu/docker-compose/portainer
state: directory
mode: '0755' # Optional file permissions
owner: ubuntu # Optional ownership
group: ubuntu # Optional group ownership
- name: Deploy Portainer using Docker Compose
ansible.builtin.template:
src: "templates/docker_compose.yaml.j2"
dest: "/home/ubuntu/docker-compose/portainer/docker-compose.yaml"
mode: '0755' # Optional file permissions
owner: ubuntu # Optional ownership
group: ubuntu # Optional group ownership
notify:
- Start Portainer
- name: Run Portainer docker-compose up
community.docker.docker_compose:
project_src: /home/ubuntu/docker-compose/portainer
state: present

View File

@ -0,0 +1,13 @@
version: '3.3'
services:
portainer:
image: portainer/portainer-ce:{{ portainer_version }}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
ports:
- "9000:9000"
restart: always
volumes:
portainer_data:

View File

@ -0,0 +1,2 @@
---
portainer_version: "latest"