Files
ansible/roles/reverse_proxy
Tuan-Dat Tran ef652fac20 refactor: yml -> yaml
Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
2025-11-07 20:44:14 +01:00
..
2025-11-07 20:44:14 +01:00
2025-11-07 20:44:14 +01:00
2025-11-07 20:44:14 +01:00
2025-10-25 09:25:40 +02:00
2025-11-07 20:44:14 +01:00
2025-07-27 16:40:46 +02:00

Ansible Role: Reverse Proxy

This role installs and configures Caddy as a reverse proxy.

Role Variables

defaults/main.yml

  • caddy_binary_url: The URL to download the Caddy binary.
  • caddy_binary_path: The path to install the Caddy binary.
  • caddy_user: The user to run Caddy as.
  • caddy_group: The group to run Caddy as.
  • caddy_config_path: The path to the Caddy configuration file.
  • caddy_log_path: The path to the Caddy log file.
  • caddy_systemd_service_path: The path to the Caddy systemd service file.
  • caddy_systemd_service_name: The name of the Caddy systemd service.
  • caddy_version: The version of Caddy to install.
  • xcaddy_version: The version of xcaddy to install.
  • go_version: The version of Go to install.
  • go_download_url: The URL to download Go from.
  • go_install_dir: The directory to install Go to.
  • caddy_custom_plugins: A list of custom plugins to install with Caddy.
  • netcup_customer_id: Your Netcup customer ID.
  • netcup_api_key: Your Netcup API key.
  • netcup_api_password: Your Netcup API password.

vars/main.yml

  • caddy_email: The email address to use for Let's Encrypt.
  • caddy_domains: A list of domains to configure for the reverse proxy.

Handlers

  • restart caddy: Restarts the Caddy service.

Tasks

main.yml

  • 00_go_install.yml: Installs Go.
  • 10_caddy_install.yml: Installs Caddy.
  • 20_xcaddy_install.yml: Installs xcaddy.
  • 30_custom_caddy.yml: Builds a custom Caddy binary with plugins.
  • 50_netcup_dns.yml: Configures Netcup DNS for Caddy.
  • 80_configure.yml: Configures Caddy.

Usage

- hosts: servers
  roles:
    - role: reverse_proxy
      vars:
        caddy_email: "user@example.com"
        caddy_domains:
          - domain: "example.com"
            proxy: "http://localhost:8080"