create folders and services

This commit is contained in:
2023-09-05 13:46:02 +02:00
parent 7a0ffc05bf
commit 06a60630a3
3 changed files with 58 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
Type=notify
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --force
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,3 @@
- name: Reload systemd
ansible.builtin.systemd:
daemon_reload: true

View File

@@ -30,3 +30,27 @@
shell: /usr/sbin/nologin
system: true
state: present
- name: Create /etc/caddy folder
ansible.builtin.file:
path: /etc/caddy
owner: root
group: caddy
mode: "0755"
state: directory
- name: Insert systemd unit
ansible.builtin.copy:
src: caddy.service
dest: /etc/systemd/system/caddy.service
mode: "0644"
notify:
- Reload systemd
- name: Create /var/www folder
ansible.builtin.file:
path: /var/www
owner: caddy
group: caddy
mode: "2775"
state: directory