Code Monkey home page Code Monkey logo

ansible-role-caddy's Introduction

Install and configures the caddy webserver.

GitHub Downloads Version
github downloads Version

This example is taken from molecule/default/converge.yml and is tested on each push, pull request and release.

---
- name: Converge
  hosts: all
  become: true
  gather_facts: true
  vars:
    caddy_config_snippets:
      - name: tls
        config: |
          tls /etc/ssl/cert.pem /etc/ssl/key.pem
    caddy_config_sites:
      - name: :80
        config: |
          root * /usr/share/caddy
          file_server

  roles:
    - role: "mullholland.caddy"

The machine needs to be prepared. In CI this is done using molecule/default/prepare.yml:

---
- name: Prepare
  hosts: all
  become: true
  gather_facts: true

  roles:
    - role: mullholland.repository_caddy

The default values for the variables are set in defaults/main.yml:

---
# systemd
caddy_service_after_units: []
caddy_service_require_units: []
caddy_env_vars: []

# Vhosts
caddy_config_globals: |
  # Enable Prometheus metrics
  servers {
    metrics
  }

caddy_config_snippets: []
#  - name: tls
#    config: |
#      tls /etc/ssl/cert.pem /etc/ssl/key.pem

# https://caddyserver.com/docs/caddyfile/patterns
caddy_config_sites: []
#  # Static file server
#  - name: example.com
#    config: |
#      root * /var/www
#      file_server
#  # Reverse proxy
#  # Proxy all requests
#  - name: example.com
#    config: |
#      reverse_proxy localhost:5000
#  # Only proxy requests having a path starting with /api/
#  # and serve static files for everything else
#  - name: example.com
#    config: |
#      root * /var/www
#      reverse_proxy /api/* localhost:5000
#      file_server
#  # php
#  - name: example.com
#    config: |
#      root * /srv/public
#      encode gzip
#      php_fastcgi localhost:9000
#      file_server
#  # php
#  - name: example.com
#    config: |
#      root * /srv/public
#      encode gzip
#      php_fastcgi localhost:9000
#      file_server
#  # redirect
#  # To add the www. subdomain with an HTTP redirect
#  - name: example.com
#    config: |
#      redir https://www.{host}{uri}
#  # To remove it
#  - name: example.com
#    config: |
#      redir https://example.com{uri}
#  # tls
#  # Wildcard certificates
#  - name: "*.example.com"
#    config:
#      tls {
#        dns <provider_name> [<params...>]
#      }
#
#      @foo host foo.example.com
#      handle @foo {
#        respond "Foo!"
#      }
#
#      @bar host bar.example.com
#      handle @bar {
#        respond "Bar!"
#      }
#
#      # Fallback for otherwise unhandled domains
#      handle {
#        abort
#      }

The following roles are used to prepare a system. You can prepare your system in another way.

Requirement GitHub GitLab
mullholland.repository_caddy Build Status GitHub Build Status GitLab

This role is a part of many compatible roles. Have a look at the documentation of these roles for further information.

Here is an overview of related roles: dependencies

This role has been tested on these container images:

container tags
EL all
Ubuntu all
Debian all

The minimum version of Ansible required is 2.10, tests have been done to:

  • The previous version.
  • The current version.
  • The development version.

If you find issues, please register them in GitHub.

MIT.

mullholland

ansible-role-caddy's People

Contributors

dependabot[bot] avatar mullholland avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.