feat: initial commit
This commit is contained in:
parent
2b0b4c707b
commit
ceda2114cc
18 changed files with 364 additions and 93 deletions
14
tasks/cleanup.yaml
Normal file
14
tasks/cleanup.yaml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
|
||||
# cleanup
|
||||
- name: "docker - prune all"
|
||||
community.docker.docker_prune:
|
||||
containers: true
|
||||
images: true
|
||||
networks: true
|
||||
volumes: true
|
||||
builder_cache: true
|
||||
|
||||
- name: "docker - force prune"
|
||||
ansible.builtin.command: "docker system prune --all --force --volumes"
|
||||
changed_when: false
|
||||
13
tasks/main.yaml
Normal file
13
tasks/main.yaml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
|
||||
# create network
|
||||
- name: "create network"
|
||||
ansible.builtin.import_tasks: "network.yaml"
|
||||
|
||||
# install pangolin
|
||||
- name: "install pangolin"
|
||||
ansible.builtin.import_tasks: "pangolin.yaml"
|
||||
|
||||
# cleanup docker
|
||||
- name: "cleanup docker"
|
||||
ansible.builtin.import_tasks: "cleanup.yaml"
|
||||
6
tasks/network.yaml
Normal file
6
tasks/network.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
|
||||
# create network
|
||||
- name: "docker create pangolin network"
|
||||
community.docker.docker_network:
|
||||
name: "pangolin"
|
||||
79
tasks/pangolin.yaml
Normal file
79
tasks/pangolin.yaml
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
---
|
||||
|
||||
# create directories
|
||||
- name: "create pangolin directories"
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: "directory"
|
||||
mode: "0755"
|
||||
loop:
|
||||
- "/mnt/pangolin/config"
|
||||
- "/mnt/pangolin/config/traefik"
|
||||
- "/mnt/pangolin/config/letsencrypt"
|
||||
|
||||
# pangolin config
|
||||
- name: "pangolin config"
|
||||
ansible.builtin.template:
|
||||
src: "templates/pangolin/config.yml.j2"
|
||||
dest: "/mnt/pangolin/config/config.yml"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
notify: "restart pangolin"
|
||||
|
||||
# run pangolin
|
||||
- name: "run pangolin"
|
||||
community.docker.docker_container:
|
||||
container_default_behavior: "no_defaults"
|
||||
detach: "yes"
|
||||
pull: "always"
|
||||
state: "started"
|
||||
name: "pangolin"
|
||||
image: "docker.io/fosrl/pangolin:latest"
|
||||
restart_policy: "unless-stopped"
|
||||
networks:
|
||||
- name: "pangolin"
|
||||
|
||||
volumes:
|
||||
- "/mnt/pangolin/config:/app/config"
|
||||
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3001/api/v1/"]
|
||||
interval: "3s"
|
||||
timeout: "3s"
|
||||
retries: 15
|
||||
|
||||
|
||||
# traefik config
|
||||
- name: "traefik config"
|
||||
ansible.builtin.template:
|
||||
src: "templates/traefik/traefik_config.yml.j2"
|
||||
dest: "/mnt/traefik/config/traefik_config.yml"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
notify: "restart traefik"
|
||||
|
||||
# run traefik
|
||||
- name: "run traefik"
|
||||
community.docker.docker_container:
|
||||
container_default_behavior: "no_defaults"
|
||||
detach: "yes"
|
||||
pull: "always"
|
||||
state: "started"
|
||||
name: "traefik"
|
||||
image: "docker.io/library/traefik:v3.5"
|
||||
restart_policy: "unless-stopped"
|
||||
networks:
|
||||
- name: "pangolin"
|
||||
|
||||
volumes:
|
||||
- "/mnt/pangolin/config/traefik:/etc/traefik:ro"
|
||||
- "/mnt/pangolin/config/letsencrypt:/letsencrypt"
|
||||
|
||||
ports:
|
||||
- "443:443/tcp"
|
||||
- "80:80/tcp"
|
||||
|
||||
command:
|
||||
- "--configFile=/etc/traefik/traefik_config.yml"
|
||||
Loading…
Add table
Add a link
Reference in a new issue