1
0
Fork 0

fix(playbook): ansible-lint issues

- prefix functions with ansible.builtin
- missing mode for file and copy functions
- boolean values use true|false values and no other (yes,no,...)

Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
This commit is contained in:
Vojtěch Mareš 2025-05-15 14:14:24 +02:00
parent 3ff9c88db7
commit dfdcf551fc
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D

View file

@ -8,43 +8,47 @@
state: present
- name: Ensure user "caddy" exists
user:
ansible.builtin.user:
name: caddy
system: yes
system: true
shell: /usr/sbin/nologin
home: /var/lib/caddy
create_home: yes
create_home: true
group: caddy
- name: Ensure directory "/etc/caddy" exists
file:
ansible.builtin.file:
path: /etc/caddy
state: directory
mode: "0644"
- name: Ensure file "/etc/caddy/Caddyfile" exists
file:
ansible.builtin.file:
path: /etc/caddy/Caddyfile
state: touch
mode: "0644"
- name: Ensure file "/etc/caddy/.env" exists"
file:
ansible.builtin.file:
path: /etc/caddy/.env
state: touch
mode: "0600"
- name: Copy Caddy binary
copy:
ansible.builtin.copy:
src: caddy
dest: /usr/bin/caddy
mode: "0755"
- name: Check if systemd unit file exists
stat:
ansible.builtin.stat:
path: /etc/systemd/system/caddy.service
register: systemd_unit_file
- name: Create systemd unit file for Caddy
copy:
ansible.builtin.copy:
dest: /etc/systemd/system/caddy.service
mode: "0644"
content: |
# caddy.service
# See: https://github.com/caddyserver/dist/blob/master/init/caddy.service
@ -71,12 +75,12 @@
when: not systemd_unit_file.stat.exists
- name: Enable and start Caddy service
systemd:
ansible.builtin.systemd:
name: caddy
enabled: yes
enabled: true
state: started
- name: Restart Caddy service
systemd:
ansible.builtin.systemd:
name: caddy
state: reloaded