Added web service
This commit is contained in:
BIN
files/usertwist
Normal file
BIN
files/usertwist
Normal file
Binary file not shown.
10
files/usertwist.service
Normal file
10
files/usertwist.service
Normal file
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Simple Web Service
|
||||
|
||||
[Service]
|
||||
User=caddy
|
||||
Group=caddy
|
||||
ExecStart=/usr/local/bin/usertwist
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,2 +1,2 @@
|
||||
[athelas]
|
||||
vps ansible_host=95.217.153.90 ansible_connection=ssh ansible_user=root
|
||||
vps ansible_host=135.181.250.127 ansible_connection=ssh ansible_user=root
|
||||
|
||||
@@ -24,24 +24,33 @@
|
||||
ansible.builtin.package:
|
||||
name: caddy
|
||||
|
||||
- name: Creating webserver root folder
|
||||
ansible.builtin.file:
|
||||
path: /var/www/html/
|
||||
state: directory
|
||||
group: caddy
|
||||
owner: caddy
|
||||
|
||||
- name: Creating webserver index.html
|
||||
ansible.builtin.file:
|
||||
path: /var/www/html/index.html
|
||||
state: touch
|
||||
group: caddy
|
||||
owner: caddy
|
||||
|
||||
- name: Editing Caddyfile
|
||||
- name: Editing Caddyfile to setup the reverse_proxy
|
||||
ansible.builtin.template:
|
||||
src: ~/ansible/templates/Caddyfile.j2
|
||||
dest: /etc/caddy/Caddyfile
|
||||
|
||||
- name: Reboot
|
||||
ansible.builtin.reboot:
|
||||
- name: Put the service binary on the remote server
|
||||
ansible.builtin.copy:
|
||||
src: ~/ansible/files/usertwist
|
||||
dest: /usr/local/bin
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
|
||||
- name: Put the service systemd file on the remote server
|
||||
ansible.builtin.copy:
|
||||
src: ~/ansible/files/usertwist.service
|
||||
dest: /etc/systemd/system
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: Enable the service systemd unit
|
||||
ansible.builtin.systemd_service:
|
||||
name: usertwist
|
||||
enabled: true
|
||||
state: started
|
||||
|
||||
- name: Restart Caddy service
|
||||
ansible.builtin.service:
|
||||
name: caddy
|
||||
state: restarted
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
jump: ACCEPT
|
||||
destination_ports:
|
||||
- "22"
|
||||
- "8081"
|
||||
- "80"
|
||||
- "443"
|
||||
|
||||
- name: Set INPUT policy to DROP
|
||||
ansible.builtin.iptables:
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
ansible.builtin.user:
|
||||
name: "motysten"
|
||||
groups: "sudo"
|
||||
shell: /bin/bash
|
||||
append: true
|
||||
password: "{{ lookup('password', '/tmp/userpass length=12 encrypt=sha512_crypt') }}"
|
||||
become: true
|
||||
|
||||
@@ -8,18 +8,16 @@
|
||||
# this machine's public IP, then replace ":80" below with your
|
||||
# domain name.
|
||||
|
||||
poc.athelas.fr {
|
||||
# Set this path to your site's directory.
|
||||
root * /var/www/html
|
||||
|
||||
# Enable the static file server.
|
||||
file_server
|
||||
poc.athelas.fr:8081 {
|
||||
|
||||
# Another common task is to set up a reverse proxy:
|
||||
# reverse_proxy localhost:8080
|
||||
reverse_proxy localhost:8080
|
||||
|
||||
# Also edit ACME server
|
||||
tls {
|
||||
ca https://acme-staging-v02.api.letsencrypt.org/directory
|
||||
}
|
||||
|
||||
# Or serve a PHP site through php-fpm:
|
||||
# php_fastcgi localhost:9000
|
||||
}
|
||||
|
||||
# Refer to the Caddy docs for more information:
|
||||
|
||||
Reference in New Issue
Block a user