Ansible module for Caddy v2?

Hi folks, has anyone considered the possibility of making an Ansible module for Caddy? It seems like the API for Caddy v2 is particularly well-suited to an Ansible module that can send commands to Caddy and retrieve useful information for Ansible playbooks. nginx_status_info seems like a plausible example of an Ansible module getting info from a web server.

Imagine writing something like:

- name: get current Caddy configuration
  caddy_info:
    url: http://localhost:2019/config/
  register: result

I can’t immediately find a good example of sending commands in an Ansible module, but I’m certain one exists. What do y’all think?

2 Likes

That sounds cool! I imagine the module will query the config at the fact gathering stage, diff the result against the desired state, then POST/PUT/PATCH the diff as appropriate? That would be awesome. It hasn’t been considered anyways.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

For future searchers, here is an Ansible module that was shared recently:

1 Like