create folders and services
This commit is contained in:
31
roles/caddy/files/caddy.service
Normal file
31
roles/caddy/files/caddy.service
Normal 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
|
||||
3
roles/caddy/handlers/main.yml
Normal file
3
roles/caddy/handlers/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
- name: Reload systemd
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user