1
0
Fork 0

ci: add ansible task to check if systemd unit file exists

This commit is contained in:
Vojtěch Mareš 2024-12-30 15:03:53 +01:00
parent 6c23fb4bb9
commit ddefe53b61
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D

View file

@ -14,6 +14,11 @@
dest: /usr/local/bin/caddy dest: /usr/local/bin/caddy
mode: "0755" mode: "0755"
- name: Check if systemd unit file exists
stat:
path: /etc/systemd/system/caddy.service
register: systemd_unit_file
- name: Create systemd unit file for Caddy - name: Create systemd unit file for Caddy
copy: copy:
dest: /etc/systemd/system/caddy.service dest: /etc/systemd/system/caddy.service
@ -31,7 +36,7 @@
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
when: not ansible_facts['systemd']['units']['caddy.service'] when: not systemd_unit_file.stat.exists
- name: Enable and start Caddy service - name: Enable and start Caddy service
systemd: systemd: