ansible-role-server/tasks/caddy-setup.yml

46 lines
1.1 KiB
YAML
Raw Normal View History

---
# Server/Caddyserver-Setup: Setup Caddy Webserver (user, directories, etc)
- name: caddyserver - Add www-data system user
become: yes
ansible.builtin.user:
name: www-data
create_home: no
system: yes
shell: /bin/false
state: present
- name: caddyserver - Add Caddy directories
become: yes
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: yes
ansible.builtin.file:
path: /var/www
state: directory
owner: www-data
group: www-data
mode: 0555
- name: caddyserver - Copy Caddy systemd service file
become: yes
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: yes
ansible.builtin.user:
name: "{{ ansible_user_id }}"
groups: www-data
append: yes