caddy

Ansible Role: Caddy

Build Status Galaxy

Install and configure Caddy.

Requirements

An Ansible 2.2 or higher installation.
This role makes use of the Ansible json_filter that requires jmespath to be installed on the Ansible machine. See the requirements.txt file for further details on the specific version of jmespath required by the role.

Role Variables

Available variables are listed below, along with default values (see defaults/main.yml):

caddy_download_url: ""
# caddy_download_url: "https://caddyserver.com/download/linux/amd64?plugins=http.prometheus&license=personal&telemetry=off"

The location of the Caddy binary to be installed. The example above show how to download a pre-compiled Caddy realease including the http.prometheus plugin. When empty, the role will download Caddy from Github.

caddy_release_tag: "latest"

The Caddy Github release to be installed. By default, the latest release published at https://github.com/caddy/caddy/releases. NB: this option has effect only when caddy_download_url == "".

caddy_user: "caddy"
caddy_group: "caddy"

Caddy system user and group.

caddy_install_path: "/opt"

Directory containing the downloaded Caddy release artifacts.

caddy_bin_path: "/usr/local/bin"

Directory to which the Caddy biyy will be symlinked.

caddy_config_file: "/etc/caddy.conf"

Path to the main Caddy configuration file.

caddy_config_import_path: "/etc/caddy.conf.d"
caddy_config_import_files:
  default: |
    127.0.0.1:8080 {
      root {{ caddy_web_root }}
    }

Caddy's additional configuration files to be imported in the caddy_config_file file.

caddy_ssl_certificates_path: "/etc/ssl/caddy"

The Caddy listen ip address and port.

caddy_web_root: "/var/www"

Caddy HTTP server default Web folder.

caddy_log_path: "/var/log/caddy"

Directory containing Caddy logs files

caddy_additional_cli_args: ""

Additional command-line arguments to be added to the Caddy service unit. For the complete refence of the available CLI arguments please refer to the output of the caddy --help command.

Dependencies

None.

Example Playbooks

$ cat playbook.yml
- name: "Install and configure Caddy"
  hosts: all
  roles:
    - { role: atosatto.caddy }

Testing

Tests are automated with Molecule.

$ pip install tox

To test all the scenarios run

$ tox

To run a custom molecule command

$ tox -e py27-ansible23 -- molecule test -s caddy-latest

License

MIT

Author Information

Andrea Tosatto (@_hilbert_)

Install
ansible-galaxy install atosatto/ansible-caddy
GitHub repository
License
mit
Downloads
170
Owner
Automation fan-boy. Head in the ☁️. Loving Containers, Micro-Services, OpenSource, Golang and Python