maxhoesel.caddy.caddy_config module – Push configuration to a given path in the caddy config
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_config.
New in maxhoesel.caddy 0.1.0
Synopsis
This modules can update the configuration stored at any valid path in the caddy config API. It is idempotent in that it will not change the config if no changes are present. You can select between all update modes supported by Caddy
Requirements
The below requirements are needed on the host that executes this module.
requestsmust be installed on the host executing the query
Parameters
Parameter |
Comments |
|---|---|
If set and path points to an existing array or array index, the module will tell Caddy to append/insert to the array (using the APIs Choices:
|
|
Address of the caddy API endpoint Default: |
|
Content to push to the specified path. Must be a dict or list corresponding to the API JSON format. Required if state=present. |
|
Whether to create the path pointing to the configuration if it doesn’t exist yet. For example, if path=apps/http/servers/myservice and Choices:
|
|
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 Choices:
|
|
Configuration path to which the configuration content will be pushed. Note that the path if is automatically prefixed with |
|
If Choices:
|
Notes
Note
Check mode is supported.
Examples
- name: Ensure HTTP server configuration is present
maxhoesel.caddy.caddy_config:
path: apps/http/servers/myserver
content:
listen:
- ":2015"
routes:
- handle:
- handler: static_response
body: Hello World!
- name: Ensure HTTP server config is absent
maxhoesel.caddy.caddy_config:
path: apps/http/servers/myserver
state: absent