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
|
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:
|
||||||
|
|
|
||||||
Reference in a new issue