maxhoesel.caddy.caddy_load module – Load a new configuration into Caddy

Note

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

To install it, use: ansible-galaxy collection install maxhoesel.caddy. You need further requirements to be able to use this module, see Requirements for details.

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

New in maxhoesel.caddy 0.1.0

Synopsis

  • This module pushes a caddy configuration to the server via the /load API endpoint. If no change between the currently running and future configuration is found, no changes will be made.

Requirements

The below requirements are needed on the host that executes this module.

  • requests must be installed on the host executing the query

Parameters

Parameter

Comments

caddy_host

string

Address of the caddy API endpoint

Default: "http://localhost:2019"

content

aliases: config, value

any

Configuration for caddy. Needs to be a mapping corresponding to the API JSON format.

force

boolean

By default, this module only pushes configurations if changes have been made compared to the currently running config. Set force=True if you always want to push the configuration, even if no changes will be made. Settings this will cause the module to always return changed=True

Choices:

  • false ← (default)

  • true

Notes

Note

  • Check mode is supported.

Examples

- name: Load Caddy config
  maxhoesel.caddy.caddy_load:
    content:
      apps:
        http:
          servers:
            example:
              listen:
                - ":80"
              routes:
                - handle:
                    - handler: "static_response"
                      body: "Hello, world!"

Authors

  • Max Hösel (@maxhoesel)