feat: add EchoIP service for external IP retrieval and update related configurations
Some checks failed
Ansible Lint Check / check-ansible (push) Failing after 13s
Nix Format Check / check-format (push) Successful in 54s
Python Lint Check / check-python (push) Failing after 11s

This commit is contained in:
Menno van Leeuwen 2025-03-26 15:07:26 +01:00
parent 61cd474450
commit 11423be2bb
Signed by: vleeuwenmenno
SSH Key Fingerprint: SHA256:OJFmjANpakwD3F2Rsws4GLtbdz1TJ5tkQF0RZmF0TRE
5 changed files with 42 additions and 1 deletions

View File

@ -117,7 +117,7 @@ def get_external_ips():
tuple: A tuple containing the IPv4 and IPv6 addresses as strings. If either
address cannot be fetched, it will be set to "Unavailable".
"""
services = ["https://ifconfig.co", "https://ifconfig.io", "https://ifconfig.me"]
services = ["https://ifconfig.co", "https://api.ipify.org", "https://myexternalip.com/raw", "https://ifconfig.io", "https://ifconfig.me"]
headers = {"User-Agent": "curl"}
ipv4, ipv6 = "Unavailable", "Unavailable"

View File

@ -43,3 +43,5 @@
enabled: true
- name: wireguard
enabled: true
- name: echoip
enabled: true

View File

@ -62,3 +62,8 @@ fladder.mvl.sh {
reverse_proxy fladder:80
tls {{ caddy_email }}
}
ip.mvl.sh {
reverse_proxy echoip:8080
tls {{ caddy_email }}
}

View File

@ -0,0 +1,7 @@
services:
echoip:
container_name: 'echoip'
image: 'mpolden/echoip:latest'
restart: unless-stopped
ports:
- '8585:8080'

View File

@ -0,0 +1,27 @@
---
- name: Deploy EchoIP service
block:
- name: Set EchoIP directories
ansible.builtin.set_fact:
echoip_service_dir: "{{ ansible_env.HOME }}/services/echoip"
- name: Create EchoIP directory
ansible.builtin.file:
path: "{{ echoip_service_dir }}"
state: directory
mode: "0755"
- name: Deploy EchoIP docker-compose.yml
ansible.builtin.template:
src: docker-compose.yml.j2
dest: "{{ echoip_service_dir }}/docker-compose.yml"
mode: "0644"
register: echoip_compose
- name: Stop EchoIP service
ansible.builtin.command: docker compose -f "{{ echoip_service_dir }}/docker-compose.yml" down --remove-orphans
when: echoip_compose.changed
- name: Start EchoIP service
ansible.builtin.command: docker compose -f "{{ echoip_service_dir }}/docker-compose.yml" up -d
when: echoip_compose.changed