Build Status Galaxy Role

Caddy Ansible Role

This role installs and configures the caddy web server. The user can specify any http configuration parameters they wish to apply their site. Any number of sites can be added with configurations of your choice.

Dependencies

None

Role Variables

The Caddyfile (notice the pipe)
default:

caddy_config: |
  localhost:2020
  gzip
  # tls email@example.com
  root /var/www
  git github.com/antoiner77/caddy-ansible

Auto update Caddy?
default:

caddy_update: yes

Features that can be added to core: DNS, awslambda, cors, expires, filemanager, filter, git, hugo, ipfilter, jsonp, jwt, locale, mailout, minify, multipass, prometheus, ratelimit, realip, search, upload
Changing this variable will reinstall Caddy with the new features if caddy_update is enabled
default:

caddy_features: git

Example Playbook

---
- hosts: all
  roles:
    - role: caddy-ansible
      caddy_config: |
        localhost:2020
        gzip

        tls email@example.com

        root /var/www
        git github.com/antoiner77/caddy-ansible

Debugging

If the service fails to start you can figure out why by looking at the output of Caddy.
Upstart (ubuntu, debian wheezy, centos/rhel 6)
tail /var/log/upstart/caddy.log
Systemd (debian jessie, centos/rhel 7)
systemctl status caddy -l

If something doesn't seem right, open an issue!

Contributing

Pull requests are welcome. Please test your changes beforehand with vagrant:

vagrant up
vagrant provision (since it already provisioned there should be no changes here)
vagrant destroy