2019-10-06 20:55:56 +00:00
|
|
|
---
|
|
|
|
# Server/Caddyserver-Setup: Setup Caddy Webserver (user, directories, etc)
|
|
|
|
|
|
|
|
- name: caddyserver - Add www-data system user
|
|
|
|
become: yes
|
2021-08-28 14:50:37 +00:00
|
|
|
ansible.builtin.user:
|
2019-10-06 20:55:56 +00:00
|
|
|
name: www-data
|
|
|
|
create_home: no
|
|
|
|
system: yes
|
|
|
|
shell: /bin/false
|
|
|
|
state: present
|
|
|
|
- name: caddyserver - Add Caddy directories
|
|
|
|
become: yes
|
2021-08-28 14:50:37 +00:00
|
|
|
ansible.builtin.file:
|
2019-10-06 20:55:56 +00:00
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
owner: www-data
|
|
|
|
group: www-data
|
|
|
|
mode: 0770
|
|
|
|
with_items:
|
2020-09-14 21:48:51 +00:00
|
|
|
- /var/lib/caddy
|
2019-10-06 20:55:56 +00:00
|
|
|
- /etc/caddy
|
|
|
|
- name: caddyserver - Add Caddy home directory
|
|
|
|
become: yes
|
2021-08-28 14:50:37 +00:00
|
|
|
ansible.builtin.file:
|
2019-10-06 20:55:56 +00:00
|
|
|
path: /var/www
|
|
|
|
state: directory
|
|
|
|
owner: www-data
|
|
|
|
group: www-data
|
|
|
|
mode: 0555
|
|
|
|
- name: caddyserver - Copy Caddy systemd service file
|
|
|
|
become: yes
|
2021-08-28 14:50:37 +00:00
|
|
|
ansible.builtin.template:
|
2019-11-12 20:06:04 +00:00
|
|
|
src: "{{ role_path }}/templates/caddy.service"
|
2019-10-06 20:55:56 +00:00
|
|
|
dest: /etc/systemd/system/caddy.service
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
|
|
|
|
- name: caddyserver - Add standard user to www-data group
|
|
|
|
become: yes
|
2021-08-28 14:50:37 +00:00
|
|
|
ansible.builtin.user:
|
2019-10-06 20:55:56 +00:00
|
|
|
name: "{{ ansible_user_id }}"
|
|
|
|
groups: www-data
|
|
|
|
append: yes
|