Compare commits

..

161 Commits

Author SHA1 Message Date
de32bdbf33 add unbound
Some checks reported errors
continuous-integration/drone/push Build was killed
2024-04-28 23:58:48 +02:00
a56802c8bb meme
Some checks reported errors
continuous-integration/drone/push Build was killed
2024-04-28 23:32:23 +02:00
c269796d99 Update roles/netplan/templates/netplan.yaml
Some checks reported errors
continuous-integration/drone/push Build was killed
2024-03-30 14:20:34 +01:00
43249b4aff remove migrating to new mirror
All checks were successful
continuous-integration/drone/push Build is passing
2023-10-22 00:16:07 +02:00
cf7209506c use unigyor mirror
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-10-21 23:46:57 +02:00
68c91699d2 remove notify
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2023-08-31 00:15:01 +02:00
8da5bc81af remove mastodon
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone Build is failing
2023-08-30 23:49:57 +02:00
fb9417908e add notify
Some checks failed
continuous-integration/drone/push Build is failing
2023-08-30 23:39:55 +02:00
52f7e7e153 remove fqdn
Some checks failed
continuous-integration/drone/push Build is failing
2023-08-30 23:13:59 +02:00
85fb26bf52 add allowed range to ssh
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-08-28 09:55:03 +02:00
e924d3e33c add quote to item
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-08-28 09:51:39 +02:00
ca386aa414 add home range for 443
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-08-28 09:49:07 +02:00
5bd2bd584b add neko to webgw
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-08-26 11:30:13 +02:00
dce0aefec1 reconfigure neko
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-08-26 11:27:32 +02:00
6193aa097a update default route
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-08-24 19:45:15 +02:00
32b2473c6c fix http in vikunja
Some checks failed
continuous-integration/drone/push Build is failing
2023-08-14 20:40:57 +02:00
8fb0ebb6fb fix vikunja
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-08-14 20:23:20 +02:00
a769494bc7 add more checks
Some checks failed
continuous-integration/drone/push Build is failing
2023-08-05 23:55:38 +02:00
71a205a1a4 change user
Some checks failed
continuous-integration/drone/push Build is failing
2023-08-05 23:49:39 +02:00
e9a88a7494 add vikunja
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-08-05 23:36:30 +02:00
eed480b853 Update roles/webgateway/vars/main.yaml
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-26 20:46:18 +02:00
95f4eae305 remove separate stage for environment setup
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-25 17:24:33 +02:00
43b95bc129 change command module to shell
Some checks failed
continuous-integration/drone Build is failing
continuous-integration/drone/push Build is failing
2023-07-25 17:17:15 +02:00
e157e89934 remove unsupported parameter
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-25 17:14:21 +02:00
fa35d4a77c fix group
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-25 17:08:53 +02:00
2af9b58d9c fix group name
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-25 17:06:27 +02:00
42214db06e fix smtpgateway
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-25 17:03:48 +02:00
8887c47c2c update everything to be ad compatible
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-25 16:58:19 +02:00
ed25955111 change ansible username
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-07-25 16:08:34 +02:00
42a6dc18e5 securiti
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-07-25 16:07:49 +02:00
f23fa80a30 fml
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-07-25 16:04:53 +02:00
d3b6348480 more corrections
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-07-25 15:59:06 +02:00
68613a253a fix mistakes
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-07-25 15:51:23 +02:00
de361fa8b6 adjust
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-07-25 15:46:14 +02:00
22c43ec52b adjust realmd
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-07-25 15:43:46 +02:00
a53b27a8fd replace usernames
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-07-25 15:00:05 +02:00
0a7746d60c add realm and update ci
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-07-25 14:46:24 +02:00
45020413f2 add gameservers
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-08 14:19:53 +02:00
51ad299afd correct netplan template
Some checks failed
continuous-integration/drone/push Build is failing
2023-04-29 15:55:04 +02:00
e52f901c38 correct netplan template
Some checks failed
continuous-integration/drone/push Build is failing
2023-04-29 15:53:46 +02:00
d2339e5d93 correct plex ipv6 addr
Some checks failed
continuous-integration/drone/push Build is failing
2023-04-29 15:51:41 +02:00
519f636b1b add default gw for plex
Some checks failed
continuous-integration/drone/push Build is failing
2023-04-29 15:50:10 +02:00
1b79e081ef update plex
Some checks failed
continuous-integration/drone/push Build is failing
2023-04-29 15:47:45 +02:00
8b2c2f1047 add plex host vars
Some checks failed
continuous-integration/drone/push Build is failing
2023-03-23 19:40:51 +01:00
baeb499aa1 add plex to webgw
Some checks failed
continuous-integration/drone/push Build is failing
2023-03-23 19:39:49 +01:00
569c4d09a2 add plex
Some checks failed
continuous-integration/drone/push Build is failing
2023-03-23 19:37:37 +01:00
7eafd343cb remove neko from nightly as it needs fixing
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-03-09 19:48:18 +01:00
2eaa562dbf add exporter
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-03-07 14:38:38 +01:00
0bf5d05c25 additional stuff is not needed
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-03-06 14:45:10 +01:00
b6a30feab9 add matrix custom path
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-03-06 14:13:01 +01:00
603f906d37 it helps if the jinja is valid
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-03-05 23:13:49 +01:00
77a184b054 maybe this
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-03-05 23:10:44 +01:00
af0f09b8b0 do not ignore cert in internal comms
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-03-05 22:51:48 +01:00
89c4c3baf0 add shit
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-03-05 22:08:45 +01:00
490f6f9e39 do not use tun+ 2023-03-05 22:04:46 +01:00
bf6d01f2d2 fix openvpn rules 2023-03-05 22:02:29 +01:00
043cab21f5 fix openvpn 2023-03-05 21:53:06 +01:00
dee3cc5dc6 servername 2023-03-05 20:49:43 +01:00
d0ec4c175e add enter 2023-03-05 20:45:37 +01:00
9b1109ca8b add email 2023-03-05 20:33:49 +01:00
188175cb0b how did that get there 2023-03-05 20:03:50 +01:00
ba26e2725a change permission 2023-03-05 19:52:33 +01:00
3a4e849592 use cloudflare memes 2023-03-05 19:48:09 +01:00
6800a75f86 modify default nginx config to listen on 443 2023-03-05 19:18:41 +01:00
95e3332f80 always use full name of ansible task 2023-03-05 19:00:38 +01:00
d83c801db1 change order so it is possible to reach nginx 2023-03-05 18:53:55 +01:00
9b50274e36 add certbot install 2023-03-05 18:37:38 +01:00
8795639cbb fix envvar
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-03-05 18:33:40 +01:00
0c7aee832c apply ansible config
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-03-05 18:32:21 +01:00
4e1833bbbf add valid cert to internal communication
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-03-05 18:26:08 +01:00
3c883cdded update to latest state
All checks were successful
continuous-integration/drone/push Build is passing
2023-02-19 13:42:53 +01:00
21a7c54b96 remove jitsi
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2023-01-14 15:30:22 +01:00
9500cbc866 adjust jitsi stuff
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-12-30 16:41:22 +01:00
025cf6e6dd add turn stuff
Some checks failed
continuous-integration/drone/push Build is failing
2022-12-30 16:09:47 +01:00
a37694f9c3 use kfki as backup time server
Some checks failed
continuous-integration/drone/push Build is failing
2022-12-30 14:42:29 +01:00
41da78f5f9 add new services
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-12-30 13:25:45 +01:00
ecea6b238b add Prometheus user to postdrop group in smtp gateway
Some checks failed
continuous-integration/drone/push Build is failing
2022-11-30 10:12:58 +01:00
41753eab2e add the Prometheus user to postdrop group
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-11-30 09:58:36 +01:00
0ec240eae5 remove extension of backupscript destination
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-11-30 09:48:57 +01:00
331cb2e7b4 fix typo
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-11-23 15:19:59 +01:00
85e0b9f978 prepare for mastodon
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-11-23 15:17:59 +01:00
21f0843995 add mastodon
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-11-23 10:37:01 +01:00
a72e23456e remove swagger vm
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-22 17:56:05 +01:00
90f86cd7d1 explicitly specify DNS servers in Docker engine configuration
Some checks failed
continuous-integration/drone/push Build is failing
2022-11-22 17:08:30 +01:00
1cdb3f168e define neko ipv6
All checks were successful
continuous-integration/drone Build is passing
2022-10-11 23:24:22 +02:00
8980bef64f update ytmirror
All checks were successful
continuous-integration/drone/push Build is passing
2022-09-29 23:41:00 +02:00
b1650d3058 update domain
Some checks failed
continuous-integration/drone/push Build is failing
2022-09-05 20:30:01 +02:00
085b8dc4ce add ytmirror domain
Some checks failed
continuous-integration/drone/push Build is failing
2022-09-05 19:06:32 +02:00
1dbc17d35f add yt mirror
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-09-05 19:05:05 +02:00
763d83323f add onedrive domain
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-04 11:52:12 +02:00
44b25bdcfb add sharepoint
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-03 19:02:57 +02:00
e24b51e3da change from systemd to cron
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-18 16:55:17 +02:00
5a5155d8e2 add monitoring to woolsey host group
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-29 12:01:41 +02:00
2ccad60ea2 use exchange online
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2022-06-09 21:39:40 +02:00
ae645735b5 add cadvisor by hand
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing
2022-05-29 23:33:34 +02:00
47a651147d remove prometheus public endpoint
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-05-29 22:55:01 +02:00
a63f359d6f use cadvisor
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-05-29 22:51:55 +02:00
bac7dbda24 add settings for postfix exporter
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-05-29 21:32:09 +02:00
b2ace001f7 fix memes
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-05-29 21:28:56 +02:00
3595d3d694 restrict memes
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-29 20:38:38 +02:00
92b53d7177 restrict on webgateway
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-05-29 20:36:40 +02:00
1417856dd6 fix the shit 2022-05-29 20:17:30 +02:00
c8aece5513 restrics metrics
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-29 19:11:16 +02:00
f6a02be7b7 firewall stuff
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-05-29 19:05:33 +02:00
ecbabfe165 change webserver exporting memes
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-29 17:25:58 +02:00
58d0700520 add stub memes
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-05-29 17:11:05 +02:00
20a215737c delete alertmanager
Some checks failed
continuous-integration/drone Build is failing
2022-05-29 16:30:16 +02:00
0e8e0b4e86 not free mode
Some checks failed
continuous-integration/drone/push Build is failing
2022-05-29 15:31:32 +02:00
590f20de67 restart services
Some checks failed
continuous-integration/drone/push Build is failing
2022-05-29 15:24:02 +02:00
f7ffff3b8d add exporters
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-05-29 15:15:02 +02:00
1a886ad9d4 allow http to continainer backend
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-28 23:24:23 +02:00
752f7bb80d add alertmanager proxy
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-28 22:22:18 +02:00
ecdfdd483a add monitoring proxy
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-28 22:05:23 +02:00
5e198281cb add monitoring
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-05-28 21:49:48 +02:00
edcbafcc2e fix matrix and neko
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-28 21:21:13 +02:00
ec38eeca21 do not edit network in nightly run
Some checks failed
continuous-integration/drone/push Build is failing
2022-05-28 21:11:23 +02:00
b65e387d7d remove docker restart from nightly run
Some checks failed
continuous-integration/drone/push Build is failing
2022-05-28 21:03:36 +02:00
85f640d49e fix ssh key secret name
Some checks reported errors
continuous-integration/drone/push Build was killed
2022-05-28 20:59:54 +02:00
cfe6fc0be4 print pwd
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone Build is failing
2022-05-28 20:37:56 +02:00
03f62c876c ansible ssh settings in nightly run
Some checks failed
continuous-integration/drone/push Build is failing
2022-05-28 20:30:11 +02:00
45bcc63b43 add nightly run 2022-05-28 19:58:38 +02:00
ca1aa3dc5e improve nginx security 2022-05-28 19:07:15 +02:00
b7d81dc75e gix jinja 2022-05-22 23:10:42 +02:00
ef3cf7ba63 a very special endpoint 2022-05-22 23:07:20 +02:00
bb24e31bea add chat proxy 2022-05-22 20:56:08 +02:00
0f84c63806 add another web meme to matrix 2022-05-22 20:53:36 +02:00
4391478805 add static memes 2022-05-22 20:48:04 +02:00
e2c74a0515 update memes 2022-05-22 20:46:29 +02:00
b5edfdc4ad fix matrix fqdn 2022-05-22 20:07:05 +02:00
292454450d perf tuning 2022-05-22 19:36:24 +02:00
173b96abba remove keycloak and add matrix 2022-05-22 19:11:36 +02:00
b0faddb9a7 remove static and reditect domains 2022-05-21 17:38:24 +02:00
e9e875d420 fix size stuff 2022-05-18 00:27:42 +02:00
c9fe2f5d83 increase nginx limits even further 2022-05-18 00:19:03 +02:00
87f57020bc increase body size 2022-05-18 00:07:07 +02:00
95cb1fdf31 add back certauth 2022-05-05 17:42:21 +02:00
df2510a74f move adfs domain 2022-05-04 21:19:44 +02:00
db242db222 move guacamole domain 2022-05-04 20:21:43 +02:00
a1212faaec add sni 2022-05-04 19:24:25 +02:00
ef91be03ec too much copypaste 2022-05-04 19:20:27 +02:00
b9f37b2d5b add ms headers to proxy 2022-05-04 19:10:43 +02:00
2776cfcadf fix typos 2022-05-04 17:05:19 +02:00
69917c65e6 fix certbot of neko 2022-05-04 14:45:34 +02:00
ab047ee852 change domains 2022-05-04 13:59:01 +02:00
2139bf02a2 freudian slip 2022-04-17 14:48:40 +02:00
31868f3b16 ansible user can become any user 2022-04-17 14:47:29 +02:00
645128198e incorporate sudo in common role 2022-04-17 14:38:46 +02:00
231bc6752e ansible sudo fix 2022-04-17 14:36:26 +02:00
a3deafec54 add memes 2022-04-17 14:26:04 +02:00
df477801d4 add redirect to nginx 2022-04-17 14:24:18 +02:00
8b295da3a3 automate all the things 2022-04-17 12:22:22 +02:00
beb1f6a308 use a single playbook to fuck everything 2022-04-17 00:26:04 +02:00
22f815e00b remove whitespace 2022-04-17 00:23:04 +02:00
5262e1b825 fuck my life 2022-04-16 23:47:29 +02:00
5fb55ed552 fucking fuck fuck fuck 2022-04-16 23:44:50 +02:00
9f5b8e72f4 copy 2022-04-16 23:42:52 +02:00
5c5e8578b7 ansible user 2022-04-16 23:37:46 +02:00
0d29e1fde5 add servicename to mysql 2022-04-16 23:03:16 +02:00
833c87cede fix mariadb hostname 2022-04-16 23:00:43 +02:00
d8acd0a697 fix db vars 2022-04-16 22:59:06 +02:00
67e0f3cc1b fix basecommand shittery 2022-04-16 21:48:40 +02:00
87 changed files with 987 additions and 407 deletions

22
.drone.yml Normal file
View File

@ -0,0 +1,22 @@
---
kind: pipeline
type: docker
name: ansible
steps:
- name: ansible nightly run
image: alpinelinux/ansible
environment:
ANSIBLE_HOST_KEY_CHECKING: "False"
ANSIBLE_PRIVATE_KEY_FILE: "/drone/src/id_rsa"
ANSIBLE_CONFIG: "/drone/src/ansible.cfg"
CLOUDFLARE_TOKEN:
from_secret: CLOUDFLARE_TOKEN
SSH_KEY:
from_secret: SSH_KEY
commands:
- echo "$SSH_KEY" > $PWD/id_rsa
- chmod 0600 $PWD/id_rsa
- ansible-galaxy collection install -r requirements.yaml
- ansible-playbook -i inventory.yaml nightly.yaml
...

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
.vault_password_file
venv/
venv/
.DS_Store

6
ansible.cfg Normal file
View File

@ -0,0 +1,6 @@
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s
[defaults]
forks=10
pipelining = True
strategy = free

View File

@ -1,10 +0,0 @@
---
- name: "Deploy backup server"
hosts: backup
roles:
- netplan
- common
- internalsmtp
- backupscript
- backuphost
...

View File

@ -1,10 +0,0 @@
---
- name: "Deploy database server base"
hosts: postgres, mariadb
roles:
- netplan
- common
- customfirewall
- backupscript
- customfirewall
...

View File

@ -1,9 +0,0 @@
---
- name: "Deploy basic webhost with Docker"
hosts: keycloak, drone, swagger, guacamole, bitwarden, nexus, nextcloud
roles:
- netplan
- common
- docker
- webserver
- internalsmtp

View File

@ -1,9 +0,0 @@
---
- name: "Deploy basic Docker host to drone-runner"
hosts: drone-runner
roles:
- netplan
- common
- docker
- internalsmtp
...

View File

@ -1,12 +0,0 @@
---
- name: "Deploy gitea in Docker"
hosts: git
roles:
- netplan
- common
- docker
- webserver
- internalsmtp
- backupscript
- customfirewall
...

8
group_vars/all.yaml Normal file
View File

@ -0,0 +1,8 @@
---
ansible_become: true
ansible_user: ansible@intra.tormakris.dev
#ansible_user: ansible
allowedranges:
- 192.168.69.0/24
- 192.168.1.0/24
...

View File

@ -1,4 +1,4 @@
---
netplan:
default_gateway: "192.168.69.254"
default_gateway: "192.168.69.253"
...

View File

@ -1,4 +1,4 @@
---
netplan:
default_gateway: "192.168.69.1"
default_gateway: "192.168.69.253"
...

View File

@ -1,4 +1,5 @@
---
ansible_host: backup.intra.tormakris.dev
servicename: mckay
backup:
host: oniel.tormakristof.eu

8
host_vars/bitwarden.yaml Normal file
View File

@ -0,0 +1,8 @@
---
ansible_host: bitwarden.intra.tormakris.dev
webserver:
- domain: "bitwarden.tormakristof.eu"
port: 8080
bigrequests: false
https: false
...

8
host_vars/cloudlog.yaml Normal file
View File

@ -0,0 +1,8 @@
---
ansible_host: cloudlog.intra.tormakris.dev
webserver:
- domain: "cloudlog.tormakristof.eu"
port: 8080
bigrequests: false
https: false
...

View File

@ -0,0 +1,3 @@
---
ansible_host: drone-runner.intra.tormakris.dev
...

8
host_vars/drone.yaml Normal file
View File

@ -0,0 +1,8 @@
---
ansible_host: drone.intra.tormakris.dev
webserver:
- domain: "drone.kmlabz.com"
port: 8080
bigrequests: false
https: false
...

View File

@ -1,13 +1,20 @@
---
ansible_host: git.intra.tormakris.dev
servicename: git
backup:
folder: "/home/service-user"
tarfolder: "gitea docker-compose.yml"
host: backup.stargate.internal
host: backup.intra.tormakris.dev
internal: true
prearecommand: ""
basedir: /mnt/backupstore
firewall:
- port: "2222"
proto: tcp
interface: "eth0"
webserver:
- domain: "git.kmlabz.com"
port: 8080
bigrequests: false
https: false
...

8
host_vars/guacamole.yaml Normal file
View File

@ -0,0 +1,8 @@
---
ansible_host: guacamole.intra.tormakris.dev
webserver:
- domain: "guacamole.tormakristof.eu"
port: 8080
bigrequests: false
https: false
...

View File

@ -0,0 +1,8 @@
---
ansible_host: librespeed.intra.tormakris.dev
webserver:
- domain: "speedtest.tormakristof.eu"
port: 8080
bigrequests: true
https: false
...

View File

@ -1,6 +0,0 @@
---
firewall:
- port: "3306"
proto: tcp
interface: "eth0"
...

16
host_vars/matrix.yaml Normal file
View File

@ -0,0 +1,16 @@
---
ansible_host: matrix.intra.tormakris.dev
webserver:
- domain: "matrix.tormakristof.eu"
port: 8080
bigrequests: true
https: false
- domain: "chat.tormakristof.eu"
port: 8181
bigrequests: true
https: false
firewall:
- port: "9000"
proto: tcp
interface: "eth0"
...

View File

@ -0,0 +1,8 @@
---
ansible_host: monitoring.intra.tormakris.dev
webserver:
- domain: "grafana.tormakristof.eu"
port: 8181
bigrequests: false
https: false
...

View File

@ -1,25 +1,28 @@
---
ansible_host: zelenka.intra.tormakris.dev
firewall:
- port: "ssh"
proto: tcp
interface: "eth0"
- port: "http"
proto: tcp
interface: "eth1"
interface: "eth0"
- port: "https"
proto: tcp
interface: "eth1"
- port: "ssh"
proto: tcp
interface: "eth1"
- port: "59000:59049"
interface: "eth0"
- port: "59000:59009"
proto: udp
interface: "eth1"
netplan:
default_gateway: ""
additionalinterfaces:
- name: "eth1"
dhcp4: true
dhcp6: true
denydns: true
interface: "eth0"
- port: "3478"
proto: tcp
interface: "eth0"
- port: "3478"
proto: any
interface: "eth0"
- port: "5349"
proto: any
interface: "eth0"
- port: "9101"
proto: tcp
interface: "eth0"
...

8
host_vars/nextcloud.yaml Normal file
View File

@ -0,0 +1,8 @@
---
ansible_host: nextcloud.intra.tormakris.dev
webserver:
- domain: "nextcloud.tormakristof.eu"
port: 8080
bigrequests: true
https: false
...

View File

@ -1,7 +1,12 @@
---
ansible_host: nexus.intra.tormakris.dev
webserver:
- domain: "nexus.kmlabz.com"
port: 8080
bigrequests: true
https: false
- domain: "registry.kmlabz.com"
port: 4269
bigrequests: true
https: false
...

View File

@ -1,4 +1,5 @@
---
ansible_host: openvpn.intra.tormakris.dev
firewall:
- port: "1194"
proto: udp

18
host_vars/plex.yaml Normal file
View File

@ -0,0 +1,18 @@
---
ansible_host: plex.intra.tormakris.dev
webserver:
- domain: "plex.tormakristof.eu"
port: 8080
bigrequests: true
https: false
netplan:
default_gateway: "192.168.69.254"
additionalinterfaces:
- name: "eth1"
dhcp4: false
dhcp6: false
denydns: true
addresses:
- '2001:738:2001:207f:0:211:211:31/64'
gateway6: 'fe80::'
...

View File

@ -1,6 +1,18 @@
---
ansible_host: postgres.intra.tormakris.dev
servicename: postgres
firewall:
- port: "5432"
proto: tcp
interface: "eth0"
- port: "9187"
proto: tcp
interface: "eth0"
backup:
folder: "/var/lib/postgresql/backup"
tarfolder: "backup"
host: backup.intra.tormakris.dev
internal: true
prearecommand: "time ( sudo -u postgres pg_dumpall > /var/lib/postgresql/backup/postgres.sql )"
basedir: /mnt/backupstore
...

3
host_vars/smtp.yaml Normal file
View File

@ -0,0 +1,3 @@
---
ansible_host: smtp.intra.tormakris.dev
...

8
host_vars/unbound.yaml Normal file
View File

@ -0,0 +1,8 @@
---
ansible_host: unbound.intra.tormakris.dev
webserver:
- domain: "dns.tormakristof.eu"
port: 8080
bigrequests: true
https: true
...

12
host_vars/vikunja.yaml Normal file
View File

@ -0,0 +1,12 @@
---
ansible_host: vikunja.intra.tormakris.dev
webserver:
- domain: "vikunja.tormakristof.eu"
port: 8081
bigrequests: false
https: false
additionallocations:
- https: false
port: 8080
location: '~* ^/(api|dav|\.well-known)/'
...

View File

@ -0,0 +1,3 @@
---
ansible_host: apache.intra.tormakris.dev
...

8
host_vars/ytmirror.yaml Normal file
View File

@ -0,0 +1,8 @@
---
ansible_host: ytmirror.intra.tormakris.dev
webserver:
- domain: "yt.tormakristof.eu"
port: 8080
bigrequests: false
https: false
...

84
infra.yaml Normal file
View File

@ -0,0 +1,84 @@
---
- name: "Deploy basic webhost with Docker"
hosts: dockerwebhosts
roles:
- netplan
- common
- docker
- webserver
- internalsmtp
- name: "Deploy database server base"
hosts: postgres
roles:
- netplan
- common
- backupscript
- customfirewall
- name: "Deploy basic Docker host to drone-runner"
hosts: drone-runner
roles:
- netplan
- common
- docker
- internalsmtp
- name: "Deploy gitea in Docker"
hosts: git
roles:
- netplan
- common
- docker
- webserver
- internalsmtp
- backupscript
- customfirewall
- name: "Setup neko"
hosts: neko
roles:
- common
- docker
- customfirewall
- internalsmtp
- name: "Deploy smtpgateway to smtp.intra.tormakris.dev"
hosts: smtp
roles:
- netplan
- common
- smtpgateway
- name: "Deploy managed web gateway"
hosts: webgateway
roles:
- common
- webgateway
- internalsmtp
- name: "Deploy backup server"
hosts: backup
roles:
- netplan
- common
- internalsmtp
- backupscript
- backuphost
- name: "Deploy OpenVPN server"
hosts: openvpn
roles:
- netplan
- common
- openvpn
- customfirewall
- internalsmtp
- name: "Deploy Game server"
hosts: gameservers
roles:
- netplan
- common
- internalsmtp
...

View File

@ -1,45 +1,55 @@
---
all:
vars:
ansible_become: true
ansible_user: tormakris
children:
woolsey:
hosts:
neko:
ansible_host: zelenka.stargate.internal
drone:
ansible_host: drone.stargate.internal
keycloak:
ansible_host: keycloak.stargate.internal
sonar:
ansible_host: sonar.stargate.internal
swagger:
ansible_host: swagger.stargate.internal
matrix:
drone-runner:
ansible_host: drone-runner.stargate.internal
smtp:
ansible_host: smtp.stargate.internal
webgateway:
ansible_host: apache.stargate.internal
openvpn:
ansible_host: openvpn.stargate.internal
nexus:
ansible_host: nexus.stargate.internal
git:
ansible_host: git.stargate.internal
postgres:
ansible_host: postgres.stargate.internal
monitoring:
ytmirror:
cloudlog:
unbound:
mckay:
hosts:
guacamole:
ansible_host: guacamole.stargate.internal
bitwarden:
ansible_host: bitwarden.stargate.internal
nextcloud:
ansible_host: nextcloud.stargate.internal
mariadb:
ansible_host: mariadb.stargate.internal
backup:
ansible_host: backup.stargate.internal
librespeed:
plex:
dockerwebhosts:
hosts:
matrix:
drone:
guacamole:
bitwarden:
nexus:
nextcloud:
monitoring:
ytmirror:
librespeed:
plex:
cloudlog:
nightlydocker:
hosts:
matrix:
guacamole:
bitwarden:
nexus:
nextcloud:
monitoring:
ytmirror:
librespeed:
plex:
cloudlog:
gameservers:
hosts:
...

View File

@ -1,10 +0,0 @@
---
- name: "Setup neko"
hosts: neko
roles:
- common
- docker
- neko
- customfirewall
- internalsmtp
...

22
nightly.yaml Normal file
View File

@ -0,0 +1,22 @@
---
- name: "Deploy basic webhost with Docker"
hosts: nightlydocker
roles:
- common
- webserver
- internalsmtp
- name: "Deploy smtpgateway to smtp.intra.tormakris.dev"
hosts: smtp
roles:
- common
- smtpgateway
- name: "Deploy backup server"
hosts: backup
roles:
- common
- internalsmtp
- backupscript
- backuphost
...

6
realmd.yaml Normal file
View File

@ -0,0 +1,6 @@
---
- name: "Deploy basic webhost with Docker"
hosts: all
roles:
- realmd
...

View File

@ -1,44 +1,11 @@
# TODO: Make backup user part of AD
---
- name: "Add backup user"
ansible.builtin.user:
user:
name: backup
comment: Backup user
shell: /bin/bash
- name: "Dsiable service user"
ansible.builtin.user:
name: service-user
state: present
password_lock: true
shell: "/sbin/nologin"
- name: Undefine AllowUsers
lineinfile:
state: absent
path: /etc/ssh/sshd_config
line: "AllowUsers tormakris ansible service-user"
- name: Check if AllowUsers is defined
lineinfile:
state: absent
path: /etc/ssh/sshd_config
regexp: "^AllowUsers"
check_mode: true
changed_when: false
register: checkallowusers
- name: Define AllowUsers if undefined
lineinfile:
state: present
path: /etc/ssh/sshd_config
line: "AllowUsers tormakris ansible backup"
when: checkallowusers.found == 0
- name: "Restart sshd"
service:
name: sshd
state: restarted
- name: Create .ssh directory of backup user
file:
path: /home/backup/.ssh

View File

@ -1,6 +1,6 @@
---
backup:
host: backup.stargate.internal
host: backup.intra.tormakris.dev
internal: true
prearecommand: ""
basedir: /mnt/backupstore

View File

@ -1,9 +0,0 @@
[Unit]
Description=Backup application data
[Service]
Type=simple
ExecStart=/usr/bin/bash /opt/backupscript.sh
[Install]
WantedBy=backup.target

View File

@ -1,5 +0,0 @@
[Unit]
Description=Script based backup for VMs
[Install]
WantedBy=default.target

View File

@ -1,10 +0,0 @@
[Unit]
Description=Backup VMs
[Timer]
OnBootSec=10min
OnCalendar=Sun *-*-* 00:00:00
Unit=backup.target
[Install]
WantedBy=multi-user.target

View File

@ -1,4 +1,4 @@
Host backup backup.stargate.internal
HostName backup.stargate.internal
Host backup backup.intra.tormakris.dev
HostName backup.intra.tormakris.dev
User backup
IdentityFile ~/.ssh/id_rsa

View File

@ -1,55 +1,12 @@
---
- name: "Generate backupscript"
ansible.builtin.template:
template:
src: backupscript.sh
dest: /opt/backupscript.sh
dest: /etc/cron.weekly/backupscript
owner: root
group: root
mode: '0700'
- name: Copy backup-script.service to target
copy:
src: backup-script.service
dest: /usr/lib/systemd/system/backup-script.service
mode: 0644
owner: root
group: root
- name: Copy backup.target to target
copy:
src: backup.target
dest: /usr/lib/systemd/system/backup.target
mode: 0644
owner: root
group: root
- name: Copy backup.timer to target
copy:
src: backup.timer
dest: /usr/lib/systemd/system/backup.timer
mode: 0644
owner: root
group: root
- name: Enable backup-script.service and reload systemd daemon
when: ansible_service_mgr == "systemd"
ansible.builtin.systemd:
enabled: yes
daemon_reload: yes
name: backup-script.service
- name: Enable backup.target
when: ansible_service_mgr == "systemd"
ansible.builtin.systemd:
enabled: yes
name: backup.target
- name: Enable backup.timer
when: ansible_service_mgr == "systemd"
ansible.builtin.systemd:
enabled: yes
name: backup.timer
- name: Create .ssh directory of root user
file:
path: /root/.ssh

View File

@ -1,8 +1,8 @@
---
# defaults file for timedatectl
timedatectl_timeservers: ['noc-a.sch.bme.hu', 'noc-b.sch.bme.hu']
timedatectl_timeservers: ['time.intra.tormakris.dev']
timedatectl_timeservers_fallback: ['time.bme.hu']
timedatectl_timeservers_fallback: ['time.kfki.hu']
timedatectl_timezone: 'Europe/Budapest'
...

View File

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDFkYMmPYQ8hs6D5tuTt+sEofoMd2GTXyS97mh8maXmets3eS8iMm2W4Pppaqj9lMIsYdDX0BZvbmuQa+iNKchj6HJPtvdx2Rhus1UGn74iy/NtgogWFHL9YEYILzc5lBqotV5o3z/wRMfSwqnVwYBZ7OI+LJenwf76bIUm6lVqyh2Qh9/wWOyGpUVitDpUVi/h2J3xZf8Z2r1vHFdMHJygrrKn3C4vsZobHJ48iq8QWj1vwfMavq6dgJtiS4/WUTvHuzjfHdyyO7akBM66Ul41UlGG5iqkIKTIzLECXPPWWe/vCIcumkeMxtoY0pxpsgKu1kgqhNs8Q+hgF/H+lIlXtzsZ5gKUwhS7sUNejNywaMjcOUVvnRVXh3FaH9t8HK7mGouaN7q+ghNbMKLlxueP5mpgzK+APaRcNjA/4JyXN750l22xM6YQkxqOeuK5FS/TVmn2H6otaxGrfGz1sfYyynvWSMqpNStuCjCYfEHBLqPKX5tpG8z/gGNa/51CQvM= tormakris@woolsey.tormakris.dev

View File

@ -1,4 +1,11 @@
---
- name: "Use custom Ubuntu mirror"
replace:
path: /etc/apt/sources.list
regexp: 'http://hu.archive.ubuntu.com'
replace: 'https://mirrors.sth.sze.hu'
backup: yes
- name: "Remove Ubuntu bloatware"
apt:
state: absent
@ -35,4 +42,6 @@
- tcpdump
- xxd
- git
- ncdu
- cron
...

View File

@ -2,8 +2,8 @@
- name: clean motd
file:
state: touch
owner: tormakris
group: tormakris
owner: tormakris@intra.tormakris.dev
group: domain users@intra.tormakris.dev
mode: "0644"
path: /home/tormakris/.hushlogin
path: /home/tormakris@intra.tormakris.dev/.hushlogin
...

View File

@ -7,4 +7,5 @@
- include_tasks: user-ops.yaml
- include_tasks: ssh-security-settings.yaml
- include_tasks: timesync.yaml
- include_tasks: node-exporter.yaml
...

View File

@ -0,0 +1,21 @@
---
- name: "Install node exporter"
apt:
update_cache: yes
state: present
name:
- prometheus-node-exporter
- name: Allow node-exporter via ufw
community.general.ufw:
rule: allow
port: 9100
proto: tcp
src: 192.168.69.0/24
- name: Enable and restart exporter daemon
service:
name: prometheus-node-exporter
state: restarted
enabled: yes
...

View File

@ -1,10 +1,4 @@
---
- name: Disable password authentication
replace:
path: /etc/ssh/sshd_config
regexp: 'PasswordAuthentication yes'
replace: 'PasswordAuthentication no'
- name: Disable root authentication
replace:
path: /etc/ssh/sshd_config
@ -23,22 +17,6 @@
regexp: '#AddressFamily any'
replace: 'AddressFamily inet'
- name: Check if AllowUsers is defined
lineinfile:
state: absent
path: /etc/ssh/sshd_config
regexp: "^AllowUsers"
check_mode: true
changed_when: false
register: checkallowusers
- name: Define AllowUsers if undefined
lineinfile:
state: present
path: /etc/ssh/sshd_config
line: "AllowUsers tormakris ansible service-user"
when: checkallowusers.found == 0
- name: "Restart sshd"
service:
name: sshd

View File

@ -12,7 +12,7 @@
- name: Reastart timesyncd to apply changes
when: ansible_service_mgr == "systemd"
ansible.builtin.systemd:
systemd:
state: restarted
daemon_reload: yes
name: systemd-timesyncd

View File

@ -18,4 +18,6 @@
community.general.ufw:
rule: allow
port: ssh
src: "{{ item }}"
with_items: "{{ allowedranges }}"
...

View File

@ -1,13 +1,38 @@
---
- name: "Add service user"
ansible.builtin.user:
name: service-user
comment: Service user
shell: /bin/bash
- name: Create .ssh directory of ansible user
file:
path: /home/ansible@intra.tormakris.dev/.ssh
state: directory
owner: ansible@intra.tormakris.dev
group: domain users@intra.tormakris.dev
- name: Copy authorized_keys
copy:
src: authorized_keys
dest: /home/ansible@intra.tormakris.dev/.ssh/authorized_keys
mode: 0600
owner: ansible@intra.tormakris.dev
group: domain users@intra.tormakris.dev
- name: Check if group is present in sudoers
lineinfile:
state: absent
path: /etc/sudoers
regexp: "^%linuxadmins"
check_mode: true
changed_when: false
register: checksudoers
- name: Define group in sudoers
lineinfile:
state: present
path: /etc/sudoers
line: "%linuxadmins@intra.tormakris.dev ALL=(ALL) NOPASSWD: ALL"
when: checksudoers.found == 0
- name: "Update authorized_keys of tormakris"
ansible.posix.authorized_key:
user: tormakris
user: tormakris@intra.tormakris.dev
state: present
key: https://static.tormakristof.eu/ssh.keys
...

View File

@ -0,0 +1,3 @@
machine tormakris.jfrog.io
login apt
password {{ artifactory_password }}

View File

@ -1,3 +1,7 @@
{
"userland-proxy": false
"userland-proxy": false,
"dns": [
"192.168.69.3",
"192.168.69.18"
]
}

View File

@ -22,9 +22,15 @@
enabled: yes
- name: "Add service user to docker group"
ansible.builtin.user:
name: service-user
comment: Service user
user:
name: service-user@intra.tormakris.dev
groups: docker
append: yes
- name: Allow docker exporter via ufw
community.general.ufw:
rule: allow
port: "4194"
proto: tcp
src: 192.168.69.0/24
...

View File

@ -1,5 +1,5 @@
---
postfix_relayhost: 'smtp.stargate.internal'
postfix_relayhost: 'smtp.intra.tormakris.dev'
external_domain: 'tormakris.dev'
...

View File

@ -0,0 +1,15 @@
# Private log file from Postfix to read and truncate. Configured in
# /etc/rsyslog.d/prometheus-postfix-exporter.conf
POSTFIXLOGFILE=/var/log/mail.log
# Extra arguments for the daemon.
ARGS=''
# Prometheus-postfix-exporter supports the following options:
# --postfix.showq_path string
# Path at which Postfix places its showq socket.
# (default "/var/spool/postfix/public/showq")
# --web.listen-address string
# Address to listen on for web interface and telemetry. (default ":9154")
# --web.telemetry-path string
# Path under which to expose metrics. (default "/metrics")

View File

@ -16,4 +16,38 @@
name: postfix
state: restarted
enabled: yes
- name: "Install postfix exporter"
apt:
update_cache: yes
state: present
name:
- prometheus-postfix-exporter
- name: Copy postfix exporter config
copy:
src: prometheus-postfix-exporter
dest: /etc/default/prometheus-postfix-exporter
owner: root
group: root
mode: '0644'
- name: Add the prometheus user to postdrop group
user:
name: prometheus
groups: postdrop
append: yes
- name: Enable and restart exporter daemon
service:
name: prometheus-postfix-exporter
state: restarted
enabled: yes
- name: Allow postfix exporter via ufw
community.general.ufw:
rule: allow
port: "9154"
proto: tcp
src: 192.168.69.0/24
...

View File

@ -1,29 +0,0 @@
---
- name: "Install haproxy via apt"
apt:
update_cache: yes
state: present
name:
- haproxy
- name: Enable haproxy
service:
name: haproxy
state: started
enabled: yes
- name: "Install certbot via apt"
apt:
update_cache: yes
state: present
name:
- python3-certbot
- name: Reset ufw rules to default
community.general.ufw:
state: reset
- name: Enable ufw
community.general.ufw:
state: enabled
...

View File

@ -6,9 +6,9 @@ network:
{{ ansible_default_ipv4.interface }}:
dhcp4: true
dhcp-identifier: mac
{% if netplan.default_gateway is defined and netplan.default_gateway|length > 0 %}
dhcp4-overrides:
use-routes: false
{% if netplan.default_gateway is defined and netplan.default_gateway|length > 0 %}
gateway4: {{netplan.default_gateway}}
{% endif %}
{% if netplan.additionalinterfaces is defined and netplan.additionalinterfaces|length > 0 %}
@ -29,7 +29,7 @@ network:
gateway4: {{interface.gateway4}}
{% endif %}
{% if interface.gateway6 is defined and interface.gateway6|length > 0 %}
gateway4: {{interface.gateway6}}
gateway6: '{{interface.gateway6}}'
{% endif %}
{% if interface.denydns %}
nameservers:

View File

@ -4,7 +4,7 @@
update_cache: yes
state: present
name:
- openvpn-server
- openvpn
- name : "Enable ipv4 forwarding via sysctl"
ansible.posix.sysctl:
@ -14,14 +14,51 @@
state: present
reload: yes
- name: Upload openvpn config to server
ansible.posix.synchronize:
src: openvpn-config
dest: /etc/openvpn/server
- name: Enable and restart openvpn daemon
service:
name: openvpn
name: openvpn-server@stargate
state: restarted
enabled: yes
- name: Check if AllowUsers is defined
lineinfile:
state: absent
path: /etc/ufw/before.rules
regexp: "^# START OPENVPN"
check_mode: true
changed_when: false
register: checkufwrules
- name: Insert openvpn iptables rules
blockinfile:
path: /etc/ufw/before.rules
block: |
# START OPENVPN RULES
# NAT table rules
*nat
-F
:POSTROUTING ACCEPT [0:0]
# Allow traffic from OpenVPN client to everywhere
-A POSTROUTING -s 192.168.37.0/24 -o eth0 -j MASQUERADE
-A POSTROUTING -s 192.168.37.0/24 -o eth2 -j MASQUERADE
COMMIT
*filter
-A ufw-before-input -i tun+ -j ACCEPT
-A ufw-before-forward -i tun+ -j ACCEPT
-A ufw-before-forward -i tun+ -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A ufw-before-forward -i eth0 -o tun+ -m state --state RELATED,ESTABLISHED -j ACCEPT
-A ufw-before-forward -i tun+ -o eth2 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A ufw-before-forward -i eth2 -o tun+ -m state --state RELATED,ESTABLISHED -j ACCEPT
COMMIT
# END OPENVPN RULES
- name: Reload ufw
community.general.ufw:
state: reloaded
- name: Apply custom ufw rules
community.general.ufw:
rule: allow
direction: "in"
interface: tun0
...

View File

@ -0,0 +1,94 @@
---
- name: "Install realmd and dependencies"
apt:
update_cache: yes
state: present
name:
- realmd
- sssd
- sssd-tools
- libnss-sss
- libpam-sss
- adcli
- samba-common-bin
- oddjob
- oddjob-mkhomedir
- packagekit
- name: Check if computer is joined to domain
lineinfile:
state: absent
path: /etc/sssd/sssd.conf
line: "^ad_access_filter"
check_mode: true
changed_when: false
register: checkjoined
- name: "Get join password from local environment variable"
set_fact:
join_passw: "{{ lookup('env', 'JOIN_PASSW') }}"
delegate_to: localhost
when: checkjoined.found == 0
- name: Join to AD with realmd
shell:
cmd: echo {{ join_passw }} | realm join -v -U tormakris_admin intra.tormakris.dev
when: checkjoined.found == 0
- name: Enable pam homedir create on first logon
command:
cmd: pam-auth-update --enable mkhomedir
- name: Check if ad_gpo_access_control is disabled
lineinfile:
state: absent
path: /etc/sssd/sssd.conf
regexp: "^ad_gpo_access_control"
check_mode: true
changed_when: false
register: checkadgpoac
- name: Set ad_gpo_access_control to disabled
lineinfile:
state: present
path: /etc/sssd/sssd.conf
line: "ad_gpo_access_control = disabled"
when: checkadgpoac.found == 0
- name: Check if ad_access_filter is set
lineinfile:
state: absent
path: /etc/sssd/sssd.conf
regexp: "^ad_access_filter"
check_mode: true
changed_when: false
register: checkadaf
- name: Set ad_gpo_access_control to disabled
lineinfile:
state: present
path: /etc/sssd/sssd.conf
line: "ad_access_filter = memberOf=CN=LinuxUsers,OU=Service Groups,DC=intra,DC=tormakris,DC=dev"
when: checkadaf.found == 0
- name: "Restart sssd"
service:
name: sssd
state: restarted
- name: Check if group is presend in sudoers
lineinfile:
state: absent
path: /etc/sudoers
regexp: "^%linuxadmins"
check_mode: true
changed_when: false
register: checksudoers
- name: Define group in sudoers
lineinfile:
state: present
path: /etc/sudoers
line: "%linuxadmins@intra.tormakris.dev ALL=(ALL) NOPASSWD: ALL"
when: checksudoers.found == 0
...

View File

@ -1,4 +1,4 @@
---
postfix_relayhost: 'smtp-relay.gmail.com'
postfix_relayhost: 'tormakris-dev.mail.protection.outlook.com'
external_domain: 'tormakris.dev'
...

View File

@ -0,0 +1,15 @@
# Private log file from Postfix to read and truncate. Configured in
# /etc/rsyslog.d/prometheus-postfix-exporter.conf
POSTFIXLOGFILE=/var/log/mail.log
# Extra arguments for the daemon.
ARGS=''
# Prometheus-postfix-exporter supports the following options:
# --postfix.showq_path string
# Path at which Postfix places its showq socket.
# (default "/var/spool/postfix/public/showq")
# --web.listen-address string
# Address to listen on for web interface and telemetry. (default ":9154")
# --web.telemetry-path string
# Path under which to expose metrics. (default "/metrics")

View File

@ -12,7 +12,8 @@
dest: /etc/postfix/main.cf
- name: Build /etc/mailname
shell: hostname --fqdn > /etc/mailname
shell:
cmd: "hostname --fqdn > /etc/mailname"
- name: Restart Postfix
service:
@ -24,4 +25,39 @@
community.general.ufw:
rule: allow
port: smtp
src: 192.168.69.0/24
- name: "Install postfix exporter"
apt:
update_cache: yes
state: present
name:
- prometheus-postfix-exporter
- name: Copy exporter config
copy:
src: prometheus-postfix-exporter
dest: /etc/default/prometheus-postfix-exporter
owner: root
group: root
mode: '0644'
- name: Add the prometheus user to postdrop group
user:
name: prometheus
groups: postdrop
append: yes
- name: Enable and restart exporter daemon
service:
name: prometheus-postfix-exporter
state: restarted
enabled: yes
- name: Allow postfix exporter via ufw
community.general.ufw:
rule: allow
port: "9154"
proto: tcp
src: 192.168.69.0/24
...

View File

@ -1,9 +0,0 @@
[Unit]
Description=Renew certificates with certbot
[Service]
Type=simple
ExecStart=/usr/bin/bash /opt/certbot.sh
[Install]
WantedBy=certbot.target

View File

@ -1,5 +0,0 @@
[Unit]
Description=Script based certificate renewal via certbot
[Install]
WantedBy=default.target

View File

@ -1,10 +0,0 @@
[Unit]
Description=Periodic certificate renewal
[Timer]
OnBootSec=10min
OnCalendar=Sun *-*-* 00:00:00
Unit=certbot.target
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,14 @@
ARGS="-nginx.scrape-uri http://127.0.0.1:8080/stub_status"
# Prometheus-nginx-exporter supports the following options:
# -nginx.plus
# Start the exporter for NGINX Plus. By default, the exporter is started
# for NGINX.
# -nginx.scrape-uri string
# A URI for scraping NGINX or NGINX Plus metrics.
# For NGINX, the stub_status page must be available through the URI.
# For NGINX Plus -- the API. (default "http://127.0.0.1:8080/stub_status")
# -web.listen-address string
# An address to listen on for web interface and telemetry. (default ":9113")
# -web.telemetry-path string
# A path under which to expose metrics. (default "/metrics"

View File

@ -19,7 +19,7 @@
port: https
- name: Copy default nginx config
ansible.builtin.copy:
copy:
src: nginx.conf
dest: /etc/nginx/nginx.conf
owner: root
@ -42,56 +42,21 @@
cmd: certbot certonly --non-interactive --agree-tos -m tormakristof@tormakristof.eu --nginx -d {{item.domain}}
with_items: "{{ static }}"
- name: Generate certificate for all redirect sites
command:
cmd: certbot certonly --non-interactive --agree-tos -m tormakristof@tormakristof.eu --nginx -d {{item.domain}}
with_items: "{{ redirect }}"
- name: "Generate certbot script"
ansible.builtin.template:
template:
src: certbot.sh
dest: /opt/certbot.sh
dest: /etc/cron.weekly/certbot
owner: root
group: root
mode: '0700'
- name: Copy certbot-script.service to target
copy:
src: certbot-script.service
dest: /usr/lib/systemd/system/certbot-script.service
mode: 644
owner: root
- name: Copy certbot.target to target
copy:
src: certbot.target
dest: /usr/lib/systemd/system/certbot.target
mode: 644
owner: root
- name: Copy certbot.timer to target
copy:
src: certbot.timer
dest: /usr/lib/systemd/system/certbot.timer
mode: 644
owner: root
- name: Enable certbot-script.service and reload systemd daemon
when: ansible_service_mgr == "systemd"
ansible.builtin.systemd:
enabled: yes
daemon_reload: yes
name: certbot-script.service
- name: Enable certbot.target
when: ansible_service_mgr == "systemd"
ansible.builtin.systemd:
enabled: yes
name: certbot.target
- name: Enable certbot.timer
when: ansible_service_mgr == "systemd"
ansible.builtin.systemd:
enabled: yes
name: certbot.timer
- name: "Generate nginx configuration"
ansible.builtin.template:
template:
src: nginx.conf
dest: /etc/nginx/nginx.conf
owner: root
@ -108,20 +73,48 @@
state: reloaded
- name: "Remove any existing static file directories"
ansible.builtin.file:
file:
path: "{{ item.directory }}"
state: absent
with_items: "{{ static }}"
- name: "Checkout static websites from git"
ansible.builtin.git:
git:
repo: "{{ item.repo }}"
dest: "{{ item.directory }}"
with_items: "{{ static }}"
- name: "Remove .git directory from static websites"
ansible.builtin.file:
file:
path: "{{ item.directory }}/.git"
state: absent
with_items: "{{ static }}"
- name: "Install nginx exporter"
apt:
update_cache: yes
state: present
name:
- prometheus-nginx-exporter
- name: Copy nginx exporter config
copy:
src: prometheus-nginx-exporter
dest: /etc/default/prometheus-nginx-exporter
owner: root
group: root
mode: '0644'
- name: Enable and restart exporter daemon
service:
name: prometheus-nginx-exporter
state: restarted
enabled: yes
- name: Allow nginx exporter via ufw
community.general.ufw:
rule: allow
port: 9113
proto: tcp
src: 192.168.69.0/24
...

View File

@ -1,8 +1,12 @@
#!/bin/bash
# {{ansible_managed}}
certbot renew --nginx --cert-name tormakristof.eu
{% for proxysite in proxy %}
certbot renew --nginx --cert-name {{ proxysite.domain }}
{% endfor %}
{% for staticsite in static %}
certbot renew --nginx --cert-name {{ staticsite.domain }}
{% endfor %}
{% for redirectsite in redirect %}
certbot renew --nginx --cert-name {{ redirectsite.domain }}
{% endfor %}

View File

@ -1,4 +1,4 @@
# {{ansible_managed}}
# {{ ansible_managed }}
user www-data;
worker_processes auto;
pid /run/nginx.pid;
@ -40,11 +40,13 @@ http {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-MS-Proxy webgateway.intra.tormakris.dev;
proxy_set_header X-MS-Forwarded-Client-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header X-Forwarded-Proto https;
client_max_body_size 10m;
proxy_ssl_server_name on;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 120;
@ -54,6 +56,7 @@ http {
proxy_busy_buffers_size 256k;
proxy_buffering off;
proxy_request_buffering off;
server_tokens off;
server {
@ -63,22 +66,35 @@ http {
return 301 https://$host$request_uri;
}
{% for proxysite in proxy %}
{%- for proxysite in proxy -%}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name {{ proxysite.domain }};
proxy_ssl_name {{ proxysite.domain }};
ssl_certificate /etc/letsencrypt/live/{{ proxysite.domain }}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{{ proxysite.domain }}/privkey.pem;
ssl_stapling on;
ssl_stapling_verify on;
{%- if proxysite.bigrequests %}
client_max_body_size 8G;
{%- endif %}
location /{
proxy_pass https://{{ proxysite.ip }};
{%- if proxysite.ignorecert %}
proxy_ssl_verify off;
{%- endif %}
}
location /metrics{
proxy_pass https://{{ proxysite.ip }};
allow 192.168.69.0/24;
deny all;
}
}
{% endfor %}
{%- endfor -%}
{% for staticsite in static %}
{%- for staticsite in static -%}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
@ -91,5 +107,46 @@ http {
}
}
{% endfor %}
{%- endfor -%}
{%- for redirectsite in redirect -%}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name {{ redirectsite.domain }};
ssl_certificate /etc/letsencrypt/live/{{ redirectsite.domain }}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{{ redirectsite.domain }}/privkey.pem;
return 301 {{ redirectsite.destination }};
}
{%- endfor -%}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name tormakristof.eu;
ssl_certificate /etc/letsencrypt/live/tormakristof.eu/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/tormakristof.eu/privkey.pem;
root /var/www/tormakristof.eu;
location /{
return 301 https://www.tormakristof.eu;
}
location /.well-known{
try_files $uri $uri/ =404;
}
location /.well-known/webfinger {
return 301 https://mastodon.tormakristof.eu$request_uri;
}
}
server {
listen 8080;
location /stub_status {
stub_status;
allow 127.0.0.1;
deny all;
}
}
}

View File

@ -1,17 +1,26 @@
proxy:
- {domain: bitwarden.tormakristof.eu, ip: bitwarden.stargate.internal}
- {domain: nextcloud.tormakristof.eu, ip: nextcloud.stargate.internal}
- {domain: drone.kmlabz.com, ip: drone.stargate.internal}
- {domain: git.kmlabz.com, ip: git.stargate.internal}
- {domain: guacamole.kmlabz.com, ip: guacamole.stargate.internal}
- {domain: keycloak.kmlabz.com, ip: keycloak.stargate.internal}
- {domain: nexus.kmlabz.com, ip: nexus.stargate.internal}
- {domain: registry.kmlabz.com, ip: nexus.stargate.internal}
- {domain: swagger.kmlabz.com, ip: swagger.stargate.internal}
- {domain: bitwarden.tormakristof.eu, ip: bitwarden.intra.tormakris.dev, bigrequests: false, ignorecert: false}
- {domain: nextcloud.tormakristof.eu, ip: nextcloud.intra.tormakris.dev, bigrequests: true, ignorecert: false}
- {domain: drone.kmlabz.com, ip: drone.intra.tormakris.dev, bigrequests: false, ignorecert: false}
- {domain: git.kmlabz.com, ip: git.intra.tormakris.dev, bigrequests: false, ignorecert: false}
- {domain: guacamole.tormakristof.eu, ip: guacamole.intra.tormakris.dev, bigrequests: false, ignorecert: false}
- {domain: matrix.tormakristof.eu, ip: matrix.intra.tormakris.dev, bigrequests: true, ignorecert: false}
- {domain: chat.tormakristof.eu, ip: matrix.intra.tormakris.dev, bigrequests: true, ignorecert: false}
- {domain: nexus.kmlabz.com, ip: nexus.intra.tormakris.dev, bigrequests: true, ignorecert: false}
- {domain: registry.kmlabz.com, ip: nexus.intra.tormakris.dev, bigrequests: true, ignorecert: false}
- {domain: fs.tormakristof.eu, ip: adfs.intra.tormakris.dev, bigrequests: false, ignorecert: true}
- {domain: certauth.fs.tormakristof.eu, ip: adfs.intra.tormakris.dev, bigrequests: false, ignorecert: true}
- {domain: grafana.tormakristof.eu, ip: monitoring.intra.tormakris.dev, bigrequests: false, ignorecert: false}
- {domain: yt.tormakristof.eu, ip: ytmirror.intra.tormakris.dev, bigrequests: false, ignorecert: false}
- {domain: speedtest.tormakristof.eu, ip: librespeed.intra.tormakris.dev, bigrequests: true, ignorecert: false}
- {domain: plex.tormakristof.eu, ip: plex.intra.tormakris.dev, bigrequests: true, ignorecert: false}
- {domain: neko.tormakristof.eu, ip: vzelenka.intra.tormakris.dev, bigrequests: false, ignorecert: false}
- {domain: cloudlog.tormakristof.eu, ip: cloudlog.intra.tormakris.dev, bigrequests: false, ignorecert: false}
- {domain: dns.tormakristof.eu, ip: unbound.intra.tormakris.dev, bigrequests: true, ignorecert: false}
static:
- {domain: tormakristof.eu, directory: /var/www/tormakristof.eu, repo: "https://git.kmlabz.com/kmlabz/homepage.git"}
- {domain: tormakris.dev, directory: /var/www/tormakristof.eu, repo: "https://git.kmlabz.com/kmlabz/homepage.git"}
- {domain: torma.xyz, directory: /var/www/tormakristof.eu, repo: "https://git.kmlabz.com/kmlabz/homepage.git"}
- {domain: kmlabz.com, directory: /var/www/kmlabz.com, repo: "https://git.kmlabz.com/kmlabz/homepage.git"}
[]
redirect:
[]
...

View File

@ -1,4 +1,6 @@
webserver:
- domain: "_"
port: 8080
bigrequests: false
https: false
...

View File

@ -58,6 +58,15 @@ http {
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
server {
root /var/www/html;
server_name _;
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
location /{
try_files $uri $uri/ =404;
}
}
}

View File

@ -0,0 +1,14 @@
ARGS="-nginx.scrape-uri http://127.0.0.1:8888/stub_status"
# Prometheus-nginx-exporter supports the following options:
# -nginx.plus
# Start the exporter for NGINX Plus. By default, the exporter is started
# for NGINX.
# -nginx.scrape-uri string
# A URI for scraping NGINX or NGINX Plus metrics.
# For NGINX, the stub_status page must be available through the URI.
# For NGINX Plus -- the API. (default "http://127.0.0.1:8080/stub_status")
# -web.listen-address string
# An address to listen on for web interface and telemetry. (default ":9113")
# -web.telemetry-path string
# A path under which to expose metrics. (default "/metrics"

View File

@ -1,13 +1,22 @@
---
- name: Allow https port via ufw
community.general.ufw:
rule: allow
port: https
src: "{{ item }}"
with_items: "{{ allowedranges }}"
- name: "Install Nginx via apt"
apt:
update_cache: yes
state: present
name:
- nginx
- python3-certbot
- python3-certbot-dns-cloudflare
- name: Copy default nginx config
ansible.builtin.copy:
copy:
src: nginx.conf
dest: /etc/nginx/nginx.conf
owner: root
@ -20,8 +29,34 @@
state: restarted
enabled: yes
- name: "Get Cloudflare token from local environment variable"
set_fact:
cloudflare_token: "{{ lookup('env', 'CLOUDFLARE_TOKEN') }}"
delegate_to: localhost
- name: "Render Cloudflare Certbot plugin configuration"
template:
src: cf-creds.ini
dest: /root/cf-creds.ini
owner: root
group: root
mode: 0600
- name: Generate certificate for all server instances
shell:
cmd: certbot certonly --non-interactive --agree-tos -m iam@tormakristof.eu --dns-cloudflare --dns-cloudflare-credentials /root/cf-creds.ini -d {{item.domain}}
with_items: "{{ webserver }}"
- name: "Generate certbot script"
template:
src: certbot.sh
dest: /etc/cron.weekly/certbot
owner: root
group: root
mode: '0700'
- name: "Generate nginx configuration"
ansible.builtin.template:
template:
src: nginx.conf
dest: /etc/nginx/nginx.conf
owner: root
@ -33,8 +68,31 @@
name: nginx
state: reloaded
- name: Allow https port via ufw
- name: "Install nginx exporter"
apt:
update_cache: yes
state: present
name:
- prometheus-nginx-exporter
- name: Allow nginx exporter via ufw
community.general.ufw:
rule: allow
port: https
port: 9113
proto: tcp
src: 192.168.69.0/24
- name: Copy nginx exporter config
copy:
src: prometheus-nginx-exporter
dest: /etc/default/prometheus-nginx-exporter
owner: root
group: root
mode: '0644'
- name: Enable and restart exporter daemon
service:
name: prometheus-nginx-exporter
state: restarted
enabled: yes
...

View File

@ -0,0 +1,5 @@
#!/bin/bash
# {{ansible_managed}}
{% for server in webserver %}
certbot renew --dns-cloudflare --dns-cloudflare-credentials /root/cf-creds.ini 10 --cert-name {{ server.domain }}
{% endfor %}

View File

@ -0,0 +1,4 @@
# Cloudflare API token used by Certbot
# {{ ansible_managed }}
dns_cloudflare_email = tormakristof@outlook.com
dns_cloudflare_api_key = {{ cloudflare_token }}

View File

@ -40,10 +40,12 @@ http {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-MS-Proxy webgateway.intra.tormakris.dev;
proxy_set_header X-MS-Forwarded-Client-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
client_max_body_size 10m;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header X-Forwarded-Proto https;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 120;
@ -53,6 +55,7 @@ http {
proxy_busy_buffers_size 256k;
proxy_buffering off;
proxy_request_buffering off;
server_tokens off;
server {
@ -67,12 +70,49 @@ http {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name {{ server.domain }};
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
ssl_certificate /etc/letsencrypt/live/{{ server.domain }}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{{ server.domain }}/privkey.pem;
{% if server.bigrequests %}
client_max_body_size 8G;
{% endif %}
location /{
{% if server.https %}
proxy_pass https://127.0.0.1:{{ server.port }};
{% else %}
proxy_pass http://127.0.0.1:{{ server.port }};
{% endif %}
}
location /metrics{
{%- if server.https %}
proxy_pass https://127.0.0.1:{{ server.port }};
{% else %}
proxy_pass http://127.0.0.1:{{ server.port }};
{% endif %}
allow 192.168.69.0/24;
deny all;
}
{% if server.additionallocations is defined %}
{% for location in server.additionallocations %}
location {{location.location}}{
{% if location.https %}
proxy_pass https://127.0.0.1:{{ location.port }};
{% else %}
proxy_pass http://127.0.0.1:{{ location.port }};
{% endif %}
}
{% endfor %}
{% endif %}
}
{% endfor %}
{%- endfor -%}
server {
listen 8888;
location /stub_status {
stub_status;
allow 127.0.0.1;
deny all;
}
}
}

6
run.sh
View File

@ -1,5 +1,7 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
ansible-galaxy collection install -r requirements.yaml
ansible-playbook --ask-become-pass --ask-pass -i inventory.yaml $1
#ansible-playbook --ask-become-pass -i inventory.yaml $1
#ansible-playbook --ask-become-pass --ask-pass -i inventory.yaml $1
ANSIBLE_CONFIG="$SCRIPT_DIR/ansible.cfg" ansible-playbook -i inventory.yaml $1

View File

@ -1,8 +0,0 @@
---
- name: "Deploy smtpgateway to smtp.stargate.internal"
hosts: smtp
roles:
- netplan
- common
- smtpgateway
...