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:
parent
3ff9c88db7
commit
dfdcf551fc
1 changed files with 16 additions and 12 deletions
28
playbook.yml
28
playbook.yml
|
|
@ -8,43 +8,47 @@
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Ensure user "caddy" exists
|
- name: Ensure user "caddy" exists
|
||||||
user:
|
ansible.builtin.user:
|
||||||
name: caddy
|
name: caddy
|
||||||
system: yes
|
system: true
|
||||||
shell: /usr/sbin/nologin
|
shell: /usr/sbin/nologin
|
||||||
home: /var/lib/caddy
|
home: /var/lib/caddy
|
||||||
create_home: yes
|
create_home: true
|
||||||
group: caddy
|
group: caddy
|
||||||
|
|
||||||
- name: Ensure directory "/etc/caddy" exists
|
- name: Ensure directory "/etc/caddy" exists
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: /etc/caddy
|
path: /etc/caddy
|
||||||
state: directory
|
state: directory
|
||||||
|
mode: "0644"
|
||||||
|
|
||||||
- name: Ensure file "/etc/caddy/Caddyfile" exists
|
- name: Ensure file "/etc/caddy/Caddyfile" exists
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: /etc/caddy/Caddyfile
|
path: /etc/caddy/Caddyfile
|
||||||
state: touch
|
state: touch
|
||||||
|
mode: "0644"
|
||||||
|
|
||||||
- name: Ensure file "/etc/caddy/.env" exists"
|
- name: Ensure file "/etc/caddy/.env" exists"
|
||||||
file:
|
ansible.builtin.file:
|
||||||
path: /etc/caddy/.env
|
path: /etc/caddy/.env
|
||||||
state: touch
|
state: touch
|
||||||
|
mode: "0600"
|
||||||
|
|
||||||
- name: Copy Caddy binary
|
- name: Copy Caddy binary
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
src: caddy
|
src: caddy
|
||||||
dest: /usr/bin/caddy
|
dest: /usr/bin/caddy
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
- name: Check if systemd unit file exists
|
- name: Check if systemd unit file exists
|
||||||
stat:
|
ansible.builtin.stat:
|
||||||
path: /etc/systemd/system/caddy.service
|
path: /etc/systemd/system/caddy.service
|
||||||
register: systemd_unit_file
|
register: systemd_unit_file
|
||||||
|
|
||||||
- name: Create systemd unit file for Caddy
|
- name: Create systemd unit file for Caddy
|
||||||
copy:
|
ansible.builtin.copy:
|
||||||
dest: /etc/systemd/system/caddy.service
|
dest: /etc/systemd/system/caddy.service
|
||||||
|
mode: "0644"
|
||||||
content: |
|
content: |
|
||||||
# caddy.service
|
# caddy.service
|
||||||
# See: https://github.com/caddyserver/dist/blob/master/init/caddy.service
|
# See: https://github.com/caddyserver/dist/blob/master/init/caddy.service
|
||||||
|
|
@ -71,12 +75,12 @@
|
||||||
when: not systemd_unit_file.stat.exists
|
when: not systemd_unit_file.stat.exists
|
||||||
|
|
||||||
- name: Enable and start Caddy service
|
- name: Enable and start Caddy service
|
||||||
systemd:
|
ansible.builtin.systemd:
|
||||||
name: caddy
|
name: caddy
|
||||||
enabled: yes
|
enabled: true
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: Restart Caddy service
|
- name: Restart Caddy service
|
||||||
systemd:
|
ansible.builtin.systemd:
|
||||||
name: caddy
|
name: caddy
|
||||||
state: reloaded
|
state: reloaded
|
||||||
|
|
|
||||||
Reference in a new issue