Compare commits

...

222 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
5d2d1be654 ensure directory exists 2022-04-16 21:20:11 +02:00
cfd20456ac copy stuff 2022-04-16 21:17:11 +02:00
ad4dac649e use right keyword 2022-04-16 21:05:42 +02:00
66cea8c669 restart ssh after fucking with config 2022-04-16 21:03:00 +02:00
f9e48a438a ssh security in backup 2022-04-16 21:00:08 +02:00
35503d6cbd backupuser 2022-04-16 20:55:19 +02:00
7e71ede2e5 fucking yaml 2022-04-16 20:50:08 +02:00
87dc0c17d2 fogyatekos vagyok 2022-04-16 20:42:51 +02:00
6f81234410 better backup template 2022-04-16 20:40:50 +02:00
ae0852bd6c fix fail 2022-04-16 20:01:29 +02:00
b372b9d28d fix nginx config 2022-04-16 19:58:50 +02:00
130a1b6704 this is a pain 2022-04-16 19:56:38 +02:00
e0aeabddf3 fuck yaml and indentation 2022-04-16 19:55:29 +02:00
404021807b ansible whitespace control 2022-04-16 19:50:17 +02:00
c1961307c9 check if additionalinterfaces is empty 2022-04-16 19:32:19 +02:00
eddd055380 fix namespace 2022-04-16 19:28:44 +02:00
080cbfdf91 prepare for full automation 2022-04-16 19:09:47 +02:00
94d50a5072 nexus stuff 2022-04-16 18:04:52 +02:00
473bedc5e9 add direction 2022-04-16 17:55:35 +02:00
ce9cfdeef5 add quotes 2022-04-16 17:52:08 +02:00
75d7aad012 custom firewall solution 2022-04-16 17:47:49 +02:00
49102eb285 remove dash 2022-04-16 17:16:52 +02:00
fffe7adbfd make backup bettr 2022-04-16 17:13:16 +02:00
e41e2b83d5 mckay is healthy now 2022-04-16 15:23:29 +02:00
4a08e9491c change order 2022-04-16 14:21:53 +02:00
c0dc56c6a1 add hosts to playbook 2022-04-16 14:11:50 +02:00
0f8a98d7cc add hosts 2022-04-16 14:07:39 +02:00
40d8c376b2 fix header too big stuff 2022-04-16 01:02:32 +02:00
057bc2ee71 add forwarded proto header 2022-04-15 00:33:12 +02:00
7260da8acd forget apache 2022-04-14 23:58:04 +02:00
2aad89e80a nginx config for docker stuff 2022-04-14 23:52:27 +02:00
ca48208928 idempotent checkout 2022-04-14 23:43:03 +02:00
5004338638 force checkout 2022-04-14 23:37:49 +02:00
464c9fecb1 non-interactive certbot shittery 2022-04-14 23:34:50 +02:00
63ae9e9a6a fix indent 2022-04-14 23:30:24 +02:00
e6a722704a add check to cert stuff 2022-04-14 23:28:13 +02:00
e425c703eb file stuff can be done when the server is ready 2022-04-14 23:16:14 +02:00
adadd086b6 fix redirect vhost 2022-04-14 23:13:17 +02:00
adc69f07d5 add static checkout 2022-04-14 23:09:44 +02:00
9a21122da6 more idempotency 2022-04-14 22:55:36 +02:00
9fde754dcb remove buffer stuff 2022-04-14 22:48:56 +02:00
e62a35af50 adjust proxy stuff 2022-04-14 22:46:44 +02:00
ba96e12495 fix registry internal ip 2022-04-14 22:40:15 +02:00
ec8cf56996 remove ipv6only 2022-04-14 22:36:27 +02:00
82b9949865 fix template bug 2022-04-14 22:31:45 +02:00
f05a32cc25 do not generate cert 2022-04-14 22:25:09 +02:00
fbd5bb72ef adjust template 2022-04-14 22:18:21 +02:00
50878bb950 switch around task order 2022-04-14 22:07:02 +02:00
9f88f210f0 use proper certbot module 2022-04-14 22:04:07 +02:00
c628326ac5 adjust inventory 2022-04-14 21:57:17 +02:00
5cfc600b37 add web gateway stuff 2022-04-14 21:41:04 +02:00
0407a0de22 update docker-host 2022-04-14 20:07:38 +02:00
e5920136c0 add openvpn stuff 2022-04-14 16:10:43 +02:00
2410f56221 expand inventory 2022-04-14 15:52:51 +02:00
667ccf6ce9 add mynetwork to smtp config 2022-04-14 15:12:05 +02:00
c52f9be563 remove port of smtp gateway 2022-04-14 15:01:22 +02:00
40aab44dec ansibleify smtp 2022-04-14 14:48:45 +02:00
aefa493b14 add drone-runner 2022-04-13 20:26:24 +02:00
2762ec51ce update run config 2022-04-13 19:59:37 +02:00
3b2e727510 update apache config 2022-04-13 19:59:31 +02:00
6835593fc3 use bash as default shell 2022-04-13 19:28:54 +02:00
97 changed files with 1646 additions and 330 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
...

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
.vault_password_file .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,8 +0,0 @@
---
- name: "Deploy basic webhost with Docker"
hosts: keycloak
roles:
- netplan
- common
- docker
- webserver

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,2 +1,4 @@
--- ---
default_gateway: "192.168.69.254" netplan:
default_gateway: "192.168.69.253"
...

View File

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

8
host_vars/backup.yaml Normal file
View File

@ -0,0 +1,8 @@
---
ansible_host: backup.intra.tormakris.dev
servicename: mckay
backup:
host: oniel.tormakristof.eu
internal: false
basedir: /mnt/backupstore
...

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
...

20
host_vars/git.yaml Normal file
View File

@ -0,0 +1,20 @@
---
ansible_host: git.intra.tormakris.dev
servicename: git
backup:
folder: "/home/service-user"
tarfolder: "gitea docker-compose.yml"
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
...

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
...

28
host_vars/neko.yaml Normal file
View File

@ -0,0 +1,28 @@
---
ansible_host: zelenka.intra.tormakris.dev
firewall:
- port: "ssh"
proto: tcp
interface: "eth0"
- port: "http"
proto: tcp
interface: "eth0"
- port: "https"
proto: tcp
interface: "eth0"
- port: "59000:59009"
proto: udp
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
...

12
host_vars/nexus.yaml Normal file
View File

@ -0,0 +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
...

24
host_vars/openvpn.yaml Normal file
View File

@ -0,0 +1,24 @@
---
ansible_host: openvpn.intra.tormakris.dev
firewall:
- port: "1194"
proto: udp
interface: "eth0"
- port: "1194"
proto: udp
interface: "eth1"
netplan:
default_gateway: ""
additionalinterfaces:
- name: "eth1"
dhcp4: false
dhcp6: false
addresses:
- "2001:738:2001:207f:0:211:211:23/64"
gateway6: "fe80::"
denydns: true
- name: "eth2"
dhcp4: true
dhcp6: false
denydns: true
...

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::'
...

18
host_vars/postgres.yaml Normal file
View File

@ -0,0 +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
...

View File

@ -1,2 +0,0 @@
---
backupscript_name: "test-backupscript.sh"

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,20 +1,55 @@
--- ---
all: all:
vars:
ansible_become: true
ansible_user: tormakris
children: children:
woolsey: woolsey:
hosts: hosts:
neko: neko:
ansible_host: zelenka.stargate.internal
drone: drone:
ansible_host: drone.stargate.internal matrix:
keycloak:
ansible_host: keycloak.stargate.internal
sonar:
ansible_host: sonar.stargate.internal
swagger:
ansible_host: swagger.stargate.internal
drone-runner: drone-runner:
ansible_host: drone-runner.stargate.internal smtp:
webgateway:
openvpn:
nexus:
git:
postgres:
monitoring:
ytmirror:
cloudlog:
unbound:
mckay:
hosts:
guacamole:
bitwarden:
nextcloud:
backup:
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,7 +0,0 @@
---
- name: "Setup neko"
hosts: neko
roles:
- common
- docker
- neko

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

@ -2,3 +2,4 @@
collections: collections:
- ansible.posix - ansible.posix
- community.general - community.general
...

View File

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCqSr3e/u2WtarrtKFhcj2E4MM/NpfREVxKnBO66HRoAUmjtNNMqS4O0OKlTLAKTFiftKeBfuvxtvdFXROXBAHekL0ff2DOuWz7k0IQjJd51x31FdVFUJZB2zk+UJENiJxwyqlQudJc7LYkztJyULfb0CYIkunTFO+fjZOUNrflrqe0JcLIgcuQqsi0gLwiQ+giWlZstdCGOq2ziqi5ZVi2Rhsgi1Lb4UsiO2B8dkxFiJMBkG+YvLl1EwZ6m9j8O92FsCsqbfoPIdcgR3XCzogSdjvKM72yKBEKs1hgGR6ajVkagWEOWXs8PC9toBcyZYt2GLncvyO1TnFDnPbecOdloifVDI23Osi+cFuOzLyi5CLs+sXaJNz1EOwlXwKhanqvCf+h11UKV7GuCjtlf6f8qOPtpTGgtOQnFie/jyNYBlcj2abNNPK5JaWtT4voY3GzpeYMV9c+bKgeS4r/7OqDn8Wpf8swWdwlGn0fBjwrVjEgAzwOH8XhHhQFGrNZbq0= root@backup-target

View File

@ -0,0 +1,4 @@
Host oniel.tormakristof.eu
HostName oniel.tormakristof.eu
User backup
IdentityFile ~/.ssh/id_rsa

View File

@ -0,0 +1,29 @@
# TODO: Make backup user part of AD
---
- name: "Add backup user"
user:
name: backup
comment: Backup user
shell: /bin/bash
- name: Create .ssh directory of backup user
file:
path: /home/backup/.ssh
state: directory
- name: Copy authorized_keys
copy:
src: authorized_keys
dest: /home/backup/.ssh/authorized_keys
mode: 0600
owner: backup
group: backup
- name: Copy ssh config
copy:
src: ssh_config
dest: /home/backup/.ssh/config
mode: 0600
owner: backup
group: backup
...

View File

@ -0,0 +1,7 @@
---
backup:
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

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

View File

@ -1 +0,0 @@
echo "true"

View File

@ -1,47 +1,22 @@
--- ---
- name: Copy backupscript to target - name: "Generate backupscript"
template:
src: backupscript.sh
dest: /etc/cron.weekly/backupscript
owner: root
group: root
mode: '0700'
- name: Create .ssh directory of root user
file:
path: /root/.ssh
state: directory
- name: Copy ssh config
copy: copy:
src: "{{ backupscript_name }}" src: ssh_config
dest: /opt/backupscript.sh dest: /root/.ssh/config
mode: 700 mode: 0600
owner: service-user owner: root
group: root
- name: Copy backup-script.service to target ...
copy:
src: backup-script.service
dest: /usr/lib/systemd/system/backup-script.service
mode: 644
owner: service-user
- name: Copy backup.target to target
copy:
src: backup.target
dest: /usr/lib/systemd/system/backup.target
mode: 644
owner: service-user
- name: Copy backup.timer to target
copy:
src: backup.timer
dest: /usr/lib/systemd/system/backup.timer
mode: 644
owner: service-user
- 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

View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# {{ansible_managed}}
{% if backup.prearecommand is defined and backup.prearecommand|length > 0 %}
{{backup.prearecommand}}
{% endif %}
{% if backup.internal %}
time ( rsync -azP --delete {{backup.folder}} backup@{{backup.host}}:{{backup.basedir}}/{{servicename}}/staging )
time ( ssh backup@{{backup.host}} 'tar -zcvf {{backup.basedir}}/{{servicename}}/{{servicename}}-$(date +"%Y-%m-%d").tar.gz -C {{backup.basedir}}/{{servicename}}/staging {{backup.tarfolder}}' )
{% else %}
time ( rsync -azPr --delete --prune-empty-dirs --include "*/" --include="*.tar.gz" --include="*.sql" --include="*.zip" --exclude="*" {{backup.basedir}}/ backup@{{backup.host}}:/mnt/backup/{{servicename}} )
{% endif %}

View File

@ -1,7 +1,8 @@
--- ---
# defaults file for timedatectl # 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' 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,3 +1,4 @@
--- ---
- name: run Timedatectl - name: run Timedatectl
command: timedatectl set-ntp true command: timedatectl set-ntp true
...

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" - name: "Remove Ubuntu bloatware"
apt: apt:
state: absent state: absent
@ -35,3 +42,6 @@
- tcpdump - tcpdump
- xxd - xxd
- git - git
- ncdu
- cron
...

View File

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

View File

@ -10,4 +10,4 @@
content: "network: {config: disabled}" content: "network: {config: disabled}"
dest: /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg dest: /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
force: no force: no
...

View File

@ -7,3 +7,5 @@
- include_tasks: user-ops.yaml - include_tasks: user-ops.yaml
- include_tasks: ssh-security-settings.yaml - include_tasks: ssh-security-settings.yaml
- include_tasks: timesync.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

@ -16,3 +16,4 @@
- /var/lib/snapd - /var/lib/snapd
- "/home/{{ ansible_user }}/snap" - "/home/{{ ansible_user }}/snap"
when: ansible_distribution == "Ubuntu" when: ansible_distribution == "Ubuntu"
...

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 - name: Disable root authentication
replace: replace:
path: /etc/ssh/sshd_config path: /etc/ssh/sshd_config
@ -23,18 +17,8 @@
regexp: '#AddressFamily any' regexp: '#AddressFamily any'
replace: 'AddressFamily inet' replace: 'AddressFamily inet'
- name: Check if AllowUsers is defined - name: "Restart sshd"
lineinfile: service:
state: absent name: sshd
path: /etc/ssh/sshd_config state: restarted
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

View File

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

View File

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

View File

@ -1,11 +1,38 @@
--- ---
- name: "Add service user" - name: Create .ssh directory of ansible user
ansible.builtin.user: file:
name: service-user path: /home/ansible@intra.tormakris.dev/.ssh
comment: Service user 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" - name: "Update authorized_keys of tormakris"
ansible.posix.authorized_key: ansible.posix.authorized_key:
user: tormakris user: tormakris@intra.tormakris.dev
state: present state: present
key: https://static.tormakristof.eu/ssh.keys key: https://static.tormakristof.eu/ssh.keys
...

View File

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

View File

@ -0,0 +1,10 @@
---
- name: Apply custom ufw rules
community.general.ufw:
rule: allow
direction: "in"
port: "{{item.port}}"
proto: "{{item.proto}}"
interface: "{{item.interface}}"
with_items: "{{ firewall }}"
...

View File

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

View File

@ -13,6 +13,7 @@
dest: /etc/docker/daemon.json dest: /etc/docker/daemon.json
mode: 644 mode: 644
owner: root owner: root
group: backup
- name: Enable and restart Docker daemon - name: Enable and restart Docker daemon
service: service:
@ -21,8 +22,15 @@
enabled: yes enabled: yes
- name: "Add service user to docker group" - name: "Add service user to docker group"
ansible.builtin.user: user:
name: service-user name: service-user@intra.tormakris.dev
comment: Service user
groups: docker groups: docker
append: yes 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,4 +1,5 @@
--- ---
postfix_relayhost: 'smtp.stargate.internal' postfix_relayhost: 'smtp.intra.tormakris.dev'
external_domain: 'kmlabz.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

@ -16,3 +16,38 @@
name: postfix name: postfix
state: restarted state: restarted
enabled: yes 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,19 +0,0 @@
---
- name: "Install MariaDB via apt"
apt:
update_cache: yes
state: present
name:
- mariadb-server
- name: Enable and restart MariaDB daemon
service:
name: mariadb
state: restarted
enabled: yes
- name: Allow mysql port via ufw
community.general.ufw:
rule: allow
port: "3306"
proto: tcp

View File

@ -1,8 +0,0 @@
---
- name: Mount up device by UUID
ansible.posix.mount:
path: "{{ mountpoint_path }}"
src: "UUID={{ mountpoint_uuid }}"
fstype: "{{ mountpoint_fstype }}"
opts: "{{ mountpoint_opts }}"
state: mounted

View File

@ -1,65 +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
- name: Allow ssh via ufw from localnet
community.general.ufw:
rule: allow
direction: in
port: ssh
from_ip: "192.168.69.0/24"
interface: eth0
- name: Allow http via ufw from internet
community.general.ufw:
rule: allow
direction: in
port: http
interface: eth1
- name: Allow https via ufw from internet
community.general.ufw:
rule: allow
direction: in
port: https
interface: eth1
- name: Allow http via ufw from internet
community.general.ufw:
rule: allow
direction: in
port: http
interface: eth1
- name: Allow neko ports via ufw from internet
community.general.ufw:
rule: allow
direction: in
port: 52000:52100
proto: udp
interface: eth1

View File

@ -0,0 +1,4 @@
---
netplan:
additionalinterfaces: []
...

View File

@ -3,3 +3,4 @@
command: netplan apply command: netplan apply
async: 45 async: 45
poll: 0 poll: 0
...

View File

@ -14,3 +14,4 @@
src: templates/netplan.yaml src: templates/netplan.yaml
dest: /etc/netplan/00-static.yaml dest: /etc/netplan/00-static.yaml
notify: netplanapply notify: netplanapply
...

View File

@ -6,6 +6,36 @@ network:
{{ ansible_default_ipv4.interface }}: {{ ansible_default_ipv4.interface }}:
dhcp4: true dhcp4: true
dhcp-identifier: mac dhcp-identifier: mac
{% if netplan.default_gateway is defined and netplan.default_gateway|length > 0 %}
dhcp4-overrides: dhcp4-overrides:
use-routes: false use-routes: false
gateway4: {{default_gateway}} gateway4: {{netplan.default_gateway}}
{% endif %}
{% if netplan.additionalinterfaces is defined and netplan.additionalinterfaces|length > 0 %}
{% for interface in netplan.additionalinterfaces %}
{{ interface.name }}:
dhcp4: {{ interface.dhcp4 }}
dhcp6: {{ interface.dhcp6 }}
dhcp-identifier: mac
dhcp4-overrides:
use-routes: false
{% if interface.addresses is defined and interface.addresses|length > 0 %}
addresses:
{% for address in interface.addresses %}
- {{address}}
{% endfor %}
{% endif %}
{% if interface.gateway4 is defined and interface.gateway4|length > 0 %}
gateway4: {{interface.gateway4}}
{% endif %}
{% if interface.gateway6 is defined and interface.gateway6|length > 0 %}
gateway6: '{{interface.gateway6}}'
{% endif %}
{% if interface.denydns %}
nameservers:
addresses: []
search: []
{% endif %}
{% endfor %}
{% endif %}
...

View File

@ -0,0 +1,64 @@
---
- name: "Install openvpn-server via apt"
apt:
update_cache: yes
state: present
name:
- openvpn
- name : "Enable ipv4 forwarding via sysctl"
ansible.posix.sysctl:
name: net.ipv4.ip_forward
value: '1'
sysctl_set: yes
state: present
reload: yes
- name: Enable and restart openvpn daemon
service:
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

@ -1,19 +0,0 @@
---
- name: "Install PostgreSQL via apt"
apt:
update_cache: yes
state: present
name:
- postgresql
- name: Enable and restart PostgreSQL daemon
service:
name: postgresql
state: restarted
enabled: yes
- name: Allow postgresql port via ufw
community.general.ufw:
rule: allow
port: "5432"
proto: tcp

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,5 +1,4 @@
--- ---
postfix_relayhost: 'smtp.sendgrid.net' postfix_relayhost: 'tormakris-dev.mail.protection.outlook.com'
external_domain: 'kmlabz.com' external_domain: 'tormakris.dev'
username: lofasz ...
password: lofasz

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

@ -6,22 +6,14 @@
name: name:
- postfix - postfix
- name: Install Postfix SASL credentials
template:
src: templates/sasl_passwd
mode: 600
dest: /etc/postfix/sasl_passwd
- name: Install Postfix mail gateway config - name: Install Postfix mail gateway config
template: template:
src: templates/main.cf src: templates/main.cf
dest: /etc/postfix/main.cf dest: /etc/postfix/main.cf
- name: Build /etc/mailname - name: Build /etc/mailname
shell: hostname --fqdn > /etc/mailname shell:
cmd: "hostname --fqdn > /etc/mailname"
- name: Build hashtable of SASL creds
command: postmap /etc/postfix/sasl_passwd
- name: Restart Postfix - name: Restart Postfix
service: service:
@ -33,3 +25,39 @@
community.general.ufw: community.general.ufw:
rule: allow rule: allow
port: smtp 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

@ -14,10 +14,6 @@ smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level=may smtpd_tls_security_level=may
smtp_tls_CApath=/etc/ssl/certs smtp_tls_CApath=/etc/ssl/certs
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_security_level = encrypt smtp_tls_security_level = encrypt
header_size_limit = 4096000 header_size_limit = 4096000
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
@ -29,8 +25,8 @@ alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases alias_database = hash:/etc/aliases
myorigin = /etc/mailname myorigin = /etc/mailname
mydestination = {{ansible_hostname}}.{{external_domain}}, $myhostname, {{ansible_hostname}}, localhost.localdomain, localhost mydestination = {{ansible_hostname}}.{{external_domain}}, $myhostname, {{ansible_hostname}}, localhost.localdomain, localhost
relayhost = {{postfix_relayhost}} relayhost = [{{postfix_relayhost}}]
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 {{ansible_default_ipv4.network}}/24
mailbox_size_limit = 0 mailbox_size_limit = 0
recipient_delimiter = + recipient_delimiter = +
inet_interfaces = all inet_interfaces = all

View File

@ -1 +0,0 @@
[{{postfix_relayhost}}:587 {{username}}:{{password}}

View File

@ -0,0 +1,63 @@
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

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

@ -1,18 +1,12 @@
--- ---
- name: "Install Apache via apt" - name: "Install nginx via apt"
apt: apt:
update_cache: yes update_cache: yes
state: present state: present
name: name:
- apache2 - nginx
- python3-certbot
# TODO: Felmasolni a templatelt konfigokat es bekapcsolni oket - python3-certbot-nginx
- name: Enable and restart Apache2 daemon
service:
name: apache2
state: restarted
enabled: yes
- name: Allow http port via ufw - name: Allow http port via ufw
community.general.ufw: community.general.ufw:
@ -23,3 +17,104 @@
community.general.ufw: community.general.ufw:
rule: allow rule: allow
port: https port: https
- name: Copy default nginx config
copy:
src: nginx.conf
dest: /etc/nginx/nginx.conf
owner: root
group: root
mode: '0644'
- name: Enable and restart nginx daemon
service:
name: nginx
state: restarted
enabled: yes
- name: Generate certificate for all proxied domains
command:
cmd: certbot certonly --non-interactive --agree-tos -m tormakristof@tormakristof.eu --nginx -d {{item.domain}}
with_items: "{{ proxy }}"
- name: Generate certificate for all static sites
command:
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"
template:
src: certbot.sh
dest: /etc/cron.weekly/certbot
owner: root
group: root
mode: '0700'
- name: "Generate nginx configuration"
template:
src: nginx.conf
dest: /etc/nginx/nginx.conf
owner: root
group: root
mode: '0644'
- name: Validate nginx configuration
command:
cmd: nginx -t
- name: Reload nginx after configuration change
service:
name: nginx
state: reloaded
- name: "Remove any existing static file directories"
file:
path: "{{ item.directory }}"
state: absent
with_items: "{{ static }}"
- name: "Checkout static websites from git"
git:
repo: "{{ item.repo }}"
dest: "{{ item.directory }}"
with_items: "{{ static }}"
- name: "Remove .git directory from static websites"
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

@ -0,0 +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

@ -0,0 +1,152 @@
# {{ ansible_managed }}
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_names_hash_bucket_size 64;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
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;
proxy_ssl_server_name on;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 120;
proxy_read_timeout 300;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_buffering off;
proxy_request_buffering off;
server_tokens off;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
{%- 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 -%}
{%- for staticsite in static -%}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name {{ staticsite.domain }};
ssl_certificate /etc/letsencrypt/live/{{ staticsite.domain }}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{{ staticsite.domain }}/privkey.pem;
root {{ staticsite.directory }};
location /{
try_files $uri $uri/ =404;
}
}
{%- 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

@ -0,0 +1,26 @@
proxy:
- {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:
[]
redirect:
[]
...

View File

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

View File

@ -1,17 +0,0 @@
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@kmlabz.com
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
ProxyPass "/" "http://127.0.0.1:8080/" retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse "/" "http://127.0.0.1:8080/"
</VirtualHost>
</IfModule>

View File

@ -0,0 +1,72 @@
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
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,28 +1,98 @@
--- ---
- name: "Install Apache via apt"
apt:
update_cache: yes
state: present
name:
- apache2
- name: Upload site config to destination
copy:
src: apache-site.conf
dest: /etc/apache2/sites-available/site.conf
mode: 644
owner: root
- name: Enable site
command: a2ensite site.conf
- name: Enable and restart Apache2 daemon
service:
name: apache2
state: restarted
enabled: yes
- name: Allow https port via ufw - name: Allow https port via ufw
community.general.ufw: community.general.ufw:
rule: allow rule: allow
port: https 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
copy:
src: nginx.conf
dest: /etc/nginx/nginx.conf
owner: root
group: root
mode: '0644'
- name: Enable and restart nginx daemon
service:
name: nginx
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"
template:
src: nginx.conf
dest: /etc/nginx/nginx.conf
owner: root
group: root
mode: '0644'
- name: Reload nginx daemon
service:
name: nginx
state: reloaded
- 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: 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

@ -0,0 +1,118 @@
# {{ansible_managed}}
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_names_hash_bucket_size 64;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
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_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 120;
proxy_read_timeout 300;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_buffering off;
proxy_request_buffering off;
server_tokens off;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
{% for server in webserver %}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name {{ server.domain }};
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 -%}
server {
listen 8888;
location /stub_status {
stub_status;
allow 127.0.0.1;
deny all;
}
}
}

5
run.sh
View File

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

8
webserver-refresh.yaml Normal file
View File

@ -0,0 +1,8 @@
---
- name: "Deploy managed web gateway"
hosts: webgateway
roles:
- common
- webgateway
- internalsmtp
...