ci: add ansible task to check if systemd unit file exists
This commit is contained in:
parent
6c23fb4bb9
commit
ddefe53b61
1 changed files with 6 additions and 1 deletions
|
|
@ -14,6 +14,11 @@
|
|||
dest: /usr/local/bin/caddy
|
||||
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
|
||||
copy:
|
||||
dest: /etc/systemd/system/caddy.service
|
||||
|
|
@ -31,7 +36,7 @@
|
|||
|
||||
[Install]
|
||||
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
|
||||
systemd:
|
||||
|
|
|
|||
Reference in a new issue