maxhoesel.caddy.caddy_server role – Install and initialize a Caddy server

Note

This role is part of the maxhoesel.caddy collection (version 1.1.0).

To install it use: ansible-galaxy collection install maxhoesel.caddy.

To use it in a playbook, specify: maxhoesel.caddy.caddy_server.

Entry point main – Install and initialize a Caddy server

Synopsis

  • This role installs the stable version of Caddy from the official repositories and performs basic configuration. The role will configure the server so that it can be managed with the modules in this collection. Alternatively, you can also configure caddy with a Caddyfile by passing it to this role.

  • The following distributions are currently supported:

    • Ubuntu 18.04 LTS or newer

    • Debian 10 or newer

    • A CentOS 8-compatible distribution like RockyLinux or AlmaLinux. RockyLinux is used for testing

    • ArchLinux (tested against the latest package versions)

  • Supported architectures: Anything supported by upstream caddy should work

  • This role requires root access. Make sure to run this role with become: true or equivalent

Parameters

Parameter

Comments

caddy_apply_config

boolean

Whether to apply the given caddy configuration. Set to false if you only want to install Caddy.

Choices:

  • false

  • true ← (default)

caddy_apt_key

string

Apt key url

Default: "https://dl.cloudsmith.io/public/caddy/stable/gpg.key"

caddy_apt_keyring

string

Apt keyring path

Default: "/usr/share/keyrings/caddy-stable-archive-keyring.gpg"

caddy_apt_repo

string

Apt repo location

Default: "https://dl.cloudsmith.io/public/caddy/stable/deb/debian any-version main"

caddy_caddyfile

string

Contents of the Caddyfile. Must be a string literal

Default: ""

caddy_config_mode

string

Whether to use the JSON API or a Caddyfile for configuration

Choices:

  • "json" ← (default)

  • "Caddyfile"

caddy_json_config

dictionary

Caddy configuration in JSON format. Must be a dict

Default: {}

caddy_rpm_key

string

Rpm repo gpg key url

Default: "https://download.copr.fedorainfracloud.org/results/@caddy/caddy/pubkey.gpg"

caddy_rpm_repo

string

Rpm repo url

Default: "https://download.copr.fedorainfracloud.org/results/@caddy/caddy/{{ 'fedora' if ansible_distribution | lower == 'fedora' else 'epel' }}-$releasever-$basearch/"