- name: Create Caddy Proxy
  hosts: deskwork-root
  tasks:
  - name: Create /etc/caddy dir
    ansible.builtin.file:
      path: /etc/caddy
      state: directory
      mode: '0755'
  - name: Copy Caddyfile
    template:
      src: secrets/deskwork.Caddyfile
      dest: /etc/caddy/Caddyfile
      owner: root
      group: root
      mode: '0644'
  - name: Template Caddy Container Services
    template:
      src: caddy.container
      dest: /etc/containers/systemd/caddy.container
      owner: root
      group: root
      mode: '0644'
  - name: Reload and start the Caddy service
    ansible.builtin.systemd_service:
      state: restarted
      name: caddy.service
      enabled: true
      daemon_reload: true
