maxhoesel / maxhoesel.caddy / 1.1.0 / module / caddy_config Push configuration to a given path in the caddy config | "added in version" 0.1.0 of maxhoesel.caddy" Authors: Max Hösel (@maxhoesel)maxhoesel.caddy.caddy_config (1.1.0) — module
Install with ansible-galaxy collection install maxhoesel.caddy:==1.1.0
collections: - name: maxhoesel.caddy version: 1.1.0
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
- 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
path: aliases: - name description: 'Configuration path to which the configuration content will be pushed. Note that the path if is automatically prefixed with C(config/). Example: C(apps/http/servers/myservice) ' required: true type: path force: default: false description: 'By default, this module only pushes configurations if changes have been made compared to the currently running config. Set I(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 C(changed=True) ' type: bool state: choices: - present - absent default: present description: 'If C(present), the configuration content at I(path) will be created or updated. If C(absent), any existing configuration at I(path) will be removed. ' type: str append: default: false description: 'If set and I(path) points to an existing array or array index, the module will tell Caddy to append/insert to the array (using the APIs C(POST/PUT) method), instead of replacing the array/array index (API C(PATCH) method). See the L(Caddy API Documentation, https://caddyserver.com/docs/api\#patch-configpath) for details. ' type: bool content: aliases: - config - value description: 'Content to push to the specified I(path). Must be a dict or list corresponding to the API JSON format. Required if I(state=present). ' type: raw caddy_host: default: http://localhost:2019 description: Address of the caddy API endpoint type: str create_path: default: true description: 'Whether to create the path pointing to the configuration if it doesn''t exist yet. For example, if I(path=apps/http/servers/myservice) and C(apps/http/servers) does not exist yet, the required path entries will be created. Note that any digit path segments are treated as array indices. ' type: bool version_added: 0.2.0 version_added_collection: maxhoesel.caddy