46 lines
1,000 B
YAML
46 lines
1,000 B
YAML
---
|
|
# Server/Caddyserver-Setup: Setup Caddy Webserver (user, directories, etc)
|
|
|
|
- name: caddyserver - Add www-data system user
|
|
become: yes
|
|
user:
|
|
name: www-data
|
|
create_home: no
|
|
system: yes
|
|
shell: /bin/false
|
|
state: present
|
|
- name: caddyserver - Add Caddy directories
|
|
become: yes
|
|
file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: www-data
|
|
group: www-data
|
|
mode: 0770
|
|
with_items:
|
|
- /etc/ssl/caddy
|
|
- /etc/caddy
|
|
- name: caddyserver - Add Caddy home directory
|
|
become: yes
|
|
file:
|
|
path: /var/www
|
|
state: directory
|
|
owner: www-data
|
|
group: www-data
|
|
mode: 0555
|
|
- name: caddyserver - Copy Caddy systemd service file
|
|
become: yes
|
|
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: yes
|
|
user:
|
|
name: "{{ ansible_user_id }}"
|
|
groups: www-data
|
|
append: yes
|