atosatto.caddy
Ansible Role: Caddy
This role installs and sets up Caddy web server.
Requirements
You need Ansible version 2.2 or higher.
This role uses the Ansible json_filter
, which requires jmespath
to be installed on the Ansible machine.
Check the requirements.txt
file for the specific version of jmespath
needed.
Role Variables
Here are the available variables with their default values (see defaults/main.yml):
caddy_download_url
: ""- This is the URL to download the Caddy binary from. If left empty, it will download from GitHub.
caddy_release_tag
: "latest"- This sets the version of Caddy to install. By default, it installs the latest version available.
caddy_user
: "caddy"- The system user for Caddy.
caddy_group
: "caddy"- The system group for Caddy.
caddy_install_path
: "/opt"- The directory where the downloaded Caddy files will be saved.
caddy_bin_path
: "/usr/local/bin"- The directory where the Caddy binary will be linked.
caddy_config_file
: "/etc/caddy.conf"- The path to the main configuration file for Caddy.
caddy_config_import_path
: "/etc/caddy.conf.d"- Folder for additional configuration files.
caddy_config_import_files
:default
: | 127.0.0.1:8080 { root {{ caddy_web_root }} }- This sets the default configuration for the Caddy server.
caddy_ssl_certificates_path
: "/etc/ssl/caddy"- The path for SSL certificates.
caddy_web_root
: "/var/www"- The default web folder for the Caddy HTTP server.
caddy_log_path
: "/var/log/caddy"- The directory for Caddy log files.
caddy_additional_cli_args
: ""- Extra command-line arguments for the Caddy service. For a list of available options, run
caddy --help
.
- Extra command-line arguments for the Caddy service. For a list of available options, run
Dependencies
There are no additional dependencies.
Example Playbooks
Here is a sample playbook:
$ cat playbook.yml
- name: "Install and configure Caddy"
hosts: all
roles:
- { role: atosatto.caddy }
Testing
Testing is automated using Molecule.
To install the testing tool:
$ pip install tox
To run all tests:
$ tox
To run a specific molecule command:
$ tox -e py27-ansible23 -- molecule test -s caddy-latest
License
This project is licensed under the MIT License.
Author Information
Created by Andrea Tosatto (@_hilbert_).
ansible-galaxy install atosatto.caddy