Compare commits

..

No commits in common. "vpn_clients" and "main" have entirely different histories.

10 changed files with 34 additions and 60 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,18 +1,6 @@
--- ---
- ansible.builtin.include_tasks: - include_role: updates.yaml
file: updates.yaml - include_role: swap.yaml
apply:
become: true
- ansible.builtin.include_tasks:
file: swap.yaml
apply:
become: true
when: configure_swap is defined 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 when: ip_tables_coonfig is defined