+
+- name: Symlink chasquid cert dir to certs-orig
+ file:
+ src: /etc/chasquid/certs-orig
+ dest: /etc/chasquid/certs
+ state: link
+ force: true
+
+- name: Deploy chasquid.conf
+ template:
+ src: chasquid.conf.j2
+ dest: /etc/chasquid/chasquid.conf
+ notify: restart chasquid
+
+# Defensive, not just reactive: clear any systemd restart backoff from a
+# previous failed attempt (e.g. a re-run after fixing something), so that
+# once certs actually exist, chasquid gets a fresh start attempt rather
+# than sitting in a backoff state from before. `notify` only fires on a
+# task reporting "changed" - on a re-run where chasquid.conf is already
+# correct, nothing would otherwise force a retry.
+- name: Clear any systemd restart backoff
+ command: systemctl reset-failed chasquid.service
+ changed_when: false
+ failed_when: false
+
+# This attempt is expected to fail on a fresh box with no certs yet - see
+# the note above. failed_when: false because that's a legitimate outcome
+# here, not a playbook error; re-run this role (or just `systemctl start
+# chasquid`) after certs are issued.
+- name: Attempt to start chasquid (expected to fail until certs exist)
+ systemd:
+ name: chasquid
+ state: started
+ failed_when: false