46 lines
1.1 KiB
YAML
46 lines
1.1 KiB
YAML
---
|
|
# Server/Caddyserver-Setup: Setup Caddy Webserver (user, directories, etc)
|
|
|
|
- name: Caddyserver - Add www-data system user
|
|
become: true
|
|
ansible.builtin.user:
|
|
name: www-data
|
|
create_home: false
|
|
system: true
|
|
shell: /bin/false
|
|
state: present
|
|
- name: Caddyserver - Add Caddy directories
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: www-data
|
|
group: www-data
|
|
mode: "0770"
|
|
with_items:
|
|
- /var/lib/caddy
|
|
- /etc/caddy
|
|
- name: Caddyserver - Add Caddy home directory
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: /var/www
|
|
state: directory
|
|
owner: www-data
|
|
group: www-data
|
|
mode: "0555"
|
|
- name: Caddyserver - Copy Caddy systemd service file
|
|
become: true
|
|
ansible.builtin.template:
|
|
src: "{{ role_path }}/templates/caddy.service"
|
|
dest: /etc/systemd/system/caddy.service
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
|
|
- name: Caddyserver - Add standard user to www-data group
|
|
become: true
|
|
ansible.builtin.user:
|
|
name: "{{ ansible_user_id }}"
|
|
groups: www-data
|
|
append: true
|