FQDNs for tasks

This commit is contained in:
Fabio Sinibaldi 2026-07-24 15:43:15 +02:00
parent 81a1bff0bb
commit bba5ad8781
2 changed files with 23 additions and 23 deletions

View File

@ -1,60 +1,60 @@
- name: Ensure Pangolin directory exists
file:
ansible.builtin.file:
path: /home/ubuntu/pangolin
state: directory
- name: Ensure Pangolin config directory exists
file:
ansible.builtin.file:
path: /home/ubuntu/pangolin/pangolin_config
state: directory
- name: Template Pangolin config file
template:
ansible.builtin.template:
src: pangolin_config.yml.j2
dest: /home/ubuntu/pangolin/pangolin_config/config.yaml
- name: Ensure Traefik config directory exists
file:
ansible.builtin.file:
path: /home/ubuntu/pangolin/config/traefik
state: directory
- name: Template Traefik config file
template:
ansible.builtin.template:
src: traefik_config.yml.j2
dest: /home/ubuntu/pangolin/config/traefik/traefik_config.yml
- name: Template Traefik dynamic config file
template:
ansible.builtin.template:
src: dynamic_config.yml.j2
dest: /home/ubuntu/pangolin/config/traefik/dynamic_config.yml
- name: Template docker-compose.yml for Pangolin
template:
ansible.builtin.template:
src: docker-compose.yml.j2
dest: /home/ubuntu/pangolin/docker-compose.yml
register: pangolin_compose_template
- name: Check if Pangolin container is running
shell: docker ps --filter "name=pangolin" --filter "status=running" --format "{{'{{.Names}}'}}"
ansible.builtin.shell: docker ps --filter "name=pangolin" --filter "status=running" --format "{{'{{.Names}}'}}"
register: pangolin_running
changed_when: false
- name: Check if Traefik container is running
shell: docker ps --filter "name=traefik" --filter "status=running" --format "{{'{{.Names}}'}}"
ansible.builtin.shell: docker ps --filter "name=traefik" --filter "status=running" --format "{{'{{.Names}}'}}"
register: traefik_running
changed_when: false
- name: Check if Gerbil container is running
shell: docker ps --filter "name=gerbil" --filter "status=running" --format "{{'{{.Names}}'}}"
ansible.builtin.shell: docker ps --filter "name=gerbil" --filter "status=running" --format "{{'{{.Names}}'}}"
register: gerbil_running
changed_when: false
- name: Set fact if compose up is needed
set_fact:
ansible.builtin.set_fact:
pangolin_compose_needs_up: "{{ pangolin_compose_template.changed or (pangolin_running.stdout != 'pangolin') or (traefik_running.stdout != 'traefik') or (gerbil_running.stdout != 'gerbil') }}"
- name: Remove conflicting Pangolin containers if present
shell: |
ansible.builtin.shell: |
docker rm -f pangolin || true
docker rm -f traefik || true
docker rm -f gerbil || true
@ -62,7 +62,7 @@
ignore_errors: true
- name: Start Pangolin and Gerbil with Docker Compose (force recreate if needed)
shell: |
ansible.builtin.shell: |
cd /home/ubuntu/pangolin
docker compose up -d --force-recreate
when: pangolin_compose_needs_up
@ -70,17 +70,17 @@
failed_when: docker_compose_up.rc != 0
- name: Check Docker Compose service status
shell: |
ansible.builtin.shell: |
cd /home/ubuntu/pangolin
docker compose ps
register: docker_compose_status
- name: Display Docker Compose service status
debug:
ansible.builtin.debug:
msg: "{{ docker_compose_status.stdout_lines }}"
- name: "Assert that mandatory variables are defined and not default"
assert:
ansible.builtin.assert:
that:
- pangolin_dashboard_url != 'https://pangolin.example.com'
- pangolin_base_domain != 'example.com'
@ -90,7 +90,7 @@
success_msg: "All mandatory variables are properly defined."
- name: Display success message
debug:
ansible.builtin.debug:
msg: |
✅ Pangolin deployment is complete!

View File

@ -1,11 +1,11 @@
---
- name: Update all packages
apt:
ansible.builtin.apt:
update_cache: yes
upgrade: dist
- name: Install essential packages
apt:
ansible.builtin.apt:
name:
- net-tools
- curl
@ -15,7 +15,7 @@
state: present
- name: Add 1GB swap file
shell: |
ansible.builtin.shell: |
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
@ -24,13 +24,13 @@
creates: /swapfile
- name: Make swap persistent
lineinfile:
ansible.builtin.lineinfile:
dest: /etc/fstab
line: '/swapfile none swap sw 0 0'
state: present
- name: Configure iptables firewall rules
iptables:
ansible.builtin.iptables:
chain: INPUT
protocol: "{{ item.protocol }}"
destination_port: "{{ item.port }}"
@ -45,6 +45,6 @@
register: iptables_result
- name: Display iptables configuration status
debug:
ansible.builtin.debug:
msg: "Configured firewall rules for ports: 80 (HTTP), 443 (HTTPS), 51820 (WireGuard UDP)"
when: iptables_result is changed