working setup with caddy
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
test1.tingker.ddns.net {
|
||||||
|
file_server
|
||||||
|
root * /var/www/html/test1
|
||||||
|
}
|
||||||
|
|
||||||
|
test2.tingker.ddns.net {
|
||||||
|
file_server
|
||||||
|
root * /var/www/html/test2
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Before using this playbook, the target hosts must have:
|
||||||
|
- Public key of control node in ~/.ssh/id_rsa.pub
|
||||||
|
- Passwordless sudo enabled (see: <https://spinupwp.com/doc/passwordless-sudo/>)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
homelab:
|
||||||
|
hosts:
|
||||||
|
rosebook.local:
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
- name: Caddy
|
||||||
|
hosts: rosebook.local
|
||||||
|
become: true
|
||||||
|
tasks:
|
||||||
|
- name: Install Caddy
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: caddy
|
||||||
|
state: present
|
||||||
|
- name: Create Caddyfile
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: /etc/caddy/Caddyfile
|
||||||
|
src: Caddyfile
|
||||||
|
- name: Web directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /var/www/html/test1
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
- name: Web directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /var/www/html/test2
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
- name: Static website
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: /var/www/html/test1/index.html
|
||||||
|
src: test1.html
|
||||||
|
- name: Static website
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: /var/www/html/test2/index.html
|
||||||
|
src: test2.html
|
||||||
|
- name: Enable and start service
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: caddy
|
||||||
|
enabled: true
|
||||||
|
state: restarted
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test 1</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Test 1</h1>
|
||||||
|
<p>This is a test page.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test 2</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Test 2</h1>
|
||||||
|
<p>This is a test page.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user