You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for writing and releasing this code, it's appreciated!
I have a role, it contains something like this:
- name: Run the Caddy roleinclude_role:
name: maxhoesel.caddy.caddy_servervars:
caddy_apply_config: truecaddy_config_mode: Caddyfilecaddy_caddyfile: | localhost:80 respond "This is the production config"
This fails at the "Caddy is running" task (roles/caddy_server/tasks/main.yml) when run for the first time, the log on the OS being:
Error: reading config file: open /etc/caddy/Caddyfile: no such file or directory
This makes sense, caddy will not start with no config file present, and we never get to the "Configure Caddy" step which would create the Caddyfile. I can work around this by creating a stub config file to be overwritten by the real config later:
- name: Check if Caddyfile existsstat:
path: /etc/caddy/Caddyfileregister: result# The caddy server doesn't start unless there's a Caddyfile present, create one if it's absent
- name: Create a stub Caddyfilewhen: not result.stat.existscopy:
dest: /etc/caddy/Caddyfilecontent: | localhost:80 respond "Hello, world!"
- name: Run the Caddy roleinclude_role:
name: maxhoesel.caddy.caddy_servervars:
caddy_apply_config: truecaddy_config_mode: Caddyfilecaddy_caddyfile: | localhost:80 respond "This is the production config"
However, that's kind of a hack and I'm not sure it was intended to work this way.
The text was updated successfully, but these errors were encountered:
Thank you for writing and releasing this code, it's appreciated!
I have a role, it contains something like this:
This fails at the "Caddy is running" task (roles/caddy_server/tasks/main.yml) when run for the first time, the log on the OS being:
This makes sense, caddy will not start with no config file present, and we never get to the "Configure Caddy" step which would create the Caddyfile. I can work around this by creating a stub config file to be overwritten by the real config later:
However, that's kind of a hack and I'm not sure it was intended to work this way.
The text was updated successfully, but these errors were encountered: