caddyserver

Ansible Role: Caddyserver v2.3.0 (currently static file for amd64, arm64, armv7)

ubuntu-18 ubuntu-20 debian-9 debian-10

License GitHub issues GitHub tag GitHub action

Description

Install and configure caddyserver using ansible.

Plugins:

  • caddy-ext_ratelimit
  • caddy-yaml
  • caddy-cgi_v2
  • caddyserver_ntlm-transport
  • caddy-authz_v2
  • caddy-auth-portal
  • caddy-docker-proxy_plugin_v2
  • caddy2-proxyprotocol
  • caddy2-filter

Requirements

  • Ansible >= 2.9 (It might work on previous versions, but we cannot guarantee it)
  • Community Packages: ansible-galaxy collection install community.general

Role Variables

All variables which can be overridden are stored in defaults/main.yml file as well as in table below.

The default webroot folder is /var/www and the default logfolder is /var/log/caddy

Name Default Value Description
caddy_system_group caddy Caddy user
caddy_system_user caddy Caddy group
caddy_logrotate_days 28 Caddy logrotate rotate days
caddy_binary_local_dir /usr/local/bin default bin dir
caddy_config [] caddy config
caddy_config_path /etc/caddy default config dir
caddy_log_path /var/log/caddy default log dir
caddy_data_path /var/www default webroot
caddy_storage_path /var/lib/caddy caddy internal storage path
caddy_auto_https on default auto https on/off
caddy_vhost_defaults defaults/main.yml#L21 default vhost params
caddy_tls_dns_cloudflare_enabled false enable cloudflare tls
cloudflare_token xxx
caddy_env_vars ['CLOUDFLARE_API_TOKEN={{ cloudflare_token }}'] see defaults
caddy_vhosts [] define vhosts configs

Example

Playbook

---
- hosts: all
  roles:
  - onkeldom.caddyserver
  vars:
    caddy_vhosts:
      - name: site1
        hostname: site1.domain.tld
        proxy_host: http://10.0.0.1
        gzip: compress
        security_headers: true
        responds: ['/forbidden 403']
        rewrites: ['* /path{uri}']
      - name: site2
        hostname: site1.domain.tld
        template: custom_template.j2

Contributing

See contributor guideline.

License

This project is licensed under MIT License. See LICENSE for more details.

About

Ansible role for installing and configuring Caddyserver

Install
ansible-galaxy install OnkelDom/ansible-role-caddyserver
GitHub repository
License
mit
Downloads
19