Compare commits

...

9 Commits

10 changed files with 60 additions and 34 deletions

View File

@ -1,3 +1,5 @@
---
docker_users:
- "{{ ansible_user }}"
- "{{ ansible_user }}"
docker_compose_projects_base_path: "/home/{{ ansible_user }}/compose_projects"

View File

@ -11,4 +11,5 @@
- geerlingguy.docker
- prepare_node
- include_role: pangolin
- include_role:
name: pangolin

View File

@ -1,14 +1,14 @@
---
- name: Create docker compose directory
ansible.builtin.file:
path: "/home/{{ ansible_user }}/compose_projects/forgejo"
path: "{{ docker_compose_projects_base_path }}/forgejo"
state: directory
mode: '0755'
register: compose_dir
- name: Create data directory
ansible.builtin.file:
path: "/home/{{ ansible_user }}/forgejo/data"
path: "{{ compose_dir }}/data"
state: directory
mode: '0755'
register: forgejo_data_dir
@ -16,7 +16,7 @@
- name: Create DB data directory
ansible.builtin.file:
path: "/home/{{ ansible_user }}/forgejo/db"
path: "{{ compose_dir }}/db"
state: directory
mode: '0755'
register: forgejo_db_dir

View File

@ -1,7 +1,7 @@
---
- name: Create docker compose directory
ansible.builtin.file:
path: "/home/{{ ansible_user }}/compose_projects/newt_compose"
path: "{{ docker_compose_projects_base_path }}/newt_compose"
state: directory
mode: '0755'
register: compose_dir

View File

@ -1,4 +1,12 @@
---
pangolin_version: "ee-latest"
gerbil_version: "latest"
traefik_version: "latest"
pangolin_base_path: "{{ docker_compose_projects_base_path }}/pangolin"
# Derived Variables
pangolin_cors_origin: "{{ pangolin_dashboard_url }}"

View File

@ -1,38 +1,46 @@
---
- name: Ensure Pangolin directory exists
ansible.builtin.file:
path: /home/ubuntu/pangolin
path: "{{ pangolin_base_path }}"
state: directory
- name: Ensure Pangolin config directory exists
ansible.builtin.file:
path: /home/ubuntu/pangolin/pangolin_config
path: "{{ pangolin_base_path }}/pangolin_config"
state: directory
register: pangolin_config_dir
- name: Template Pangolin config file
ansible.builtin.template:
src: pangolin_config.yml.j2
dest: /home/ubuntu/pangolin/pangolin_config/config.yaml
dest: "{{ pangolin_config_dir.path }}/config.yaml"
- name: Ensure Letsencrypt config directory exists
ansible.builtin.file:
path: "{{ pangolin_config_dir.path }}/letsencrypt"
state: directory
register: letsencrypt_config_directory
- name: Ensure Traefik config directory exists
ansible.builtin.file:
path: /home/ubuntu/pangolin/config/traefik
path: "{{ pangolin_config_dir.path }}/traefik"
state: directory
register: traefik_config_directory
- name: Template Traefik config file
ansible.builtin.template:
src: traefik_config.yml.j2
dest: /home/ubuntu/pangolin/config/traefik/traefik_config.yml
dest: "{{ traefik_config_directory.path }}/traefik_config.yml"
- name: Template Traefik dynamic config file
ansible.builtin.template:
src: dynamic_config.yml.j2
dest: /home/ubuntu/pangolin/config/traefik/dynamic_config.yml
dest: "{{ traefik_config_directory.path }}/dynamic_config.yml"
- name: Template docker-compose.yml for Pangolin
ansible.builtin.template:
src: docker-compose.yml.j2
dest: /home/ubuntu/pangolin/docker-compose.yml
dest: "{{ pangolin_base_path }}/docker-compose.yml"
register: pangolin_compose_template
- name: Check if Pangolin container is running
@ -64,7 +72,7 @@
- name: Start Pangolin and Gerbil with Docker Compose (force recreate if needed)
ansible.builtin.shell: |
cd /home/ubuntu/pangolin
cd {{ pangolin_base_path }}
docker compose up -d --force-recreate
when: pangolin_compose_needs_up
register: docker_compose_up
@ -72,7 +80,7 @@
- name: Check Docker Compose service status
ansible.builtin.shell: |
cd /home/ubuntu/pangolin
cd {{ pangolin_base_path }}
docker compose ps
register: docker_compose_status

View File

@ -1,10 +1,3 @@
---
- ansible.builtin.include_tasks: prepare_node.yaml
- include_role:
name: geerlingguy.docker
apply:
become: true
- ansible.builtin.include_tasks:
file: docker_pangolin.yaml
apply:
become: true
file: docker_pangolin.yaml

View File

@ -1,10 +1,10 @@
services:
pangolin:
image: fosrl/pangolin:ee-latest
image: fosrl/pangolin:{{ pangolin_version }}
container_name: pangolin
restart: unless-stopped
volumes:
- ./pangolin_config:/app/config
- {{ pangolin_config_dir.path }}:/app/config
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/api/v1/"]
interval: "3s"
@ -12,7 +12,7 @@ services:
retries: 15
gerbil:
image: fosrl/gerbil:1.0.0
image: fosrl/gerbil:{{ gerbil_version }}
container_name: gerbil
restart: unless-stopped
depends_on:
@ -30,11 +30,12 @@ services:
- SYS_MODULE
ports:
- 51820:51820/udp
- 21820:21820/udp
- 443:443 # Port for traefik because of the network_mode
- 80:80 # Port for traefik because of the network_mode
traefik:
image: traefik:v3.4.1
image: traefik:{{ traefik_version }}
container_name: traefik
restart: unless-stopped
network_mode: service:gerbil # Ports appear on the gerbil service
@ -44,9 +45,9 @@ services:
command:
- --configFile=/etc/traefik/traefik_config.yml
volumes:
- ./config/traefik:/etc/traefik:ro # Volume to store the Traefik configuration
- ./config/letsencrypt:/letsencrypt # Volume to store the Let's Encrypt certificates
- ./config/traefik/logs:/var/log/traefik # Volume to store Traefik logs
- {{ traefik_config_directory.path }}:/etc/traefik:ro # Volume to store the Traefik configuration
- {{ letsencrypt_config_directory.path }}:/letsencrypt # Volume to store the Let's Encrypt certificates
- {{ traefik_config_directory.path }}/logs:/var/log/traefik # Volume to store Traefik logs
networks:
default:
driver: bridge

View File

@ -11,11 +11,12 @@
- { protocol: tcp, port: '80', description: 'HTTP for Lets Encrypt ACME challenge' }
- { protocol: tcp, port: '443', description: 'HTTPS for secure web traffic' }
- { protocol: udp, port: '51820', description: 'WireGuard VPN traffic' }
- { protocol: udp, port: '21820', description: 'WireGuard VPN traffic clients' }
become: true
become_exe: "{{ become_exe_value }}"
register: iptables_result
- name: Display iptables configuration status
ansible.builtin.debug:
msg: "Configured firewall rules for ports: 80 (HTTP), 443 (HTTPS), 51820 (WireGuard UDP)"
msg: "Configured firewall rules for ports: 80 (HTTP), 443 (HTTPS), 51820 (WireGuard UDP), 21820 (VPN UDP clients)"
when: iptables_result is changed

View File

@ -1,6 +1,18 @@
---
- include_role: updates.yaml
- include_role: swap.yaml
- ansible.builtin.include_tasks:
file: updates.yaml
apply:
become: true
- ansible.builtin.include_tasks:
file: swap.yaml
apply:
become: true
when: configure_swap is defined
- include_role: iptables.yaml
- ansible.builtin.include_tasks:
file: iptables.yaml
apply:
become: true
when: ip_tables_coonfig is defined