3 Commits

Author SHA1 Message Date
  Thomas Buck 3a70dd1dbc unfinished stuff 3 months ago
  Thomas Buck c9ab98cab1 use iot telegraf to push tasmota mqtt messages to influx 3 months ago
  Thomas Buck 96c235798d ansible "include" is deprecated. use "include_tasks". 3 months ago

+ 3
- 2
README.md View File

@@ -7,6 +7,7 @@ I removed a bunch of roles from the upstream version, added new ones, and made i
7 7
 Ubuntu is no longer supported, simply because I just use Debian.
8 8
 
9 9
 I also added the ability for full-fledged user-management using OpenLDAP and FusionDirectory.
10
+It automatically creates E-Mail inboxes for LDAP users, as well as allowing login using LDAP credentials on most roles / services.
10 11
 This is optional, however.
11 12
 You can also use statically configured credentials, which is enough for single-user setups.
12 13
 
@@ -83,7 +84,7 @@ Or you can just add your `deploy` user to the sudo group.
83 84
 
84 85
 Download this repository somewhere on your machine, either through `Clone or Download > Download ZIP` above, `wget`, or `git` as below.
85 86
 Also install the dependencies for password generation as well as ansible itself.
86
-    
87
+
87 88
     git clone https://github.com/xythobuz/sovereign.git
88 89
     cd sovereign
89 90
     sudo pip install -r ./requirements.txt
@@ -111,7 +112,7 @@ Create `A` and `AAAA` or `CNAME` records which point to your server's IP address
111 112
 To run the whole thing:
112 113
 
113 114
     ansible-playbook -i ./hosts --ask-sudo-pass --key-file KEY site.yml
114
-    
115
+
115 116
 If you chose to make a passwordless sudo deploy user, you can omit the `--ask-sudo-pass` argument.
116 117
 If you don't need to specify an ssh key to connect to the host, leave out `--key-file KEY` part, otherwise replace `KEY` with the path to the key you want to use.
117 118
 Append eg. `-l testing` to only run for the hosts in the testing group.

+ 8
- 0
TODO.md View File

@@ -0,0 +1,8 @@
1
+# TODOs
2
+
3
+* Add apache2 access and error logs for installed servers to logrotate
4
+
5
+* Crawlers create large archives in gitea for repos.
6
+  These can be deleted in the gitea admin interface.
7
+  Add automated task to delete these (if required)?
8
+  https://github.com/go-gitea/gitea/issues/5292#issuecomment-769264637

+ 1
- 1
roles/backup/tasks/main.yml View File

@@ -1 +1 @@
1
-- include: backup.yml tags=backup
1
+- include_tasks: backup.yml

+ 3
- 3
roles/blog/tasks/main.yml View File

@@ -1,3 +1,3 @@
1
-- include: blog.yml tags=blog
2
-- include: fathom.yml tags=blog
3
-- include: commento.yml tags=blog
1
+- include_tasks: blog.yml
2
+- include_tasks: fathom.yml
3
+- include_tasks: commento.yml

+ 8
- 8
roles/common/tasks/main.yml View File

@@ -1,10 +1,10 @@
1 1
 ---
2 2
 
3
-- include: basics.yml tags=basics
4
-- include: users.yml tags=users
5
-- include: apache.yml tags=apache
6
-- include: ufw.yml tags=ufw
7
-- include: security.yml tags=security
8
-- include: ntp.yml tags=ntp
9
-- include: postgres.yml
10
-- include: swap.yml
3
+- include_tasks: basics.yml
4
+- include_tasks: users.yml
5
+- include_tasks: apache.yml
6
+- include_tasks: ufw.yml
7
+- include_tasks: security.yml
8
+- include_tasks: ntp.yml
9
+- include_tasks: postgres.yml
10
+- include_tasks: swap.yml

+ 1
- 1
roles/dokuwiki/tasks/main.yml View File

@@ -1 +1 @@
1
-- include: dokuwiki.yml tags=dokuwiki
1
+- include_tasks: dokuwiki.yml

+ 2
- 0
roles/gitea/defaults/main.yml View File

@@ -7,6 +7,8 @@ gitea_release: "https://github.com/go-gitea/gitea/releases/download/v{{ gitea_ve
7 7
 gitea_admin_username: "{{ main_user_name }}"
8 8
 gitea_admin_password: "{{ lookup('password', secret + '/' + 'gitea_admin_password length=32') }}"
9 9
 
10
+gitea_enable_ldap: false
11
+
10 12
 gitea_db_username: giteauser
11 13
 gitea_db_password: "{{ lookup('password', secret + '/' + 'gitea_db_password length=32') }}"
12 14
 gitea_db_database: gitea

+ 11
- 0
roles/gitea/tasks/gitea.yml View File

@@ -90,6 +90,17 @@
90 90
     chdir: /data/gitea
91 91
   ignore_errors: True
92 92
 
93
+# check if ldap already enabled
94
+#gitea admin auth list
95
+
96
+# remove ldap auth if it exists
97
+#gitea admin auth delete
98
+
99
+# add ldap auth, if configured
100
+#gitea admin auth add-ldap --name customldap --security-protocol unencrypted --host localhost --port 389 --bind-dn "uid=admin,ou=people,dc=shagohod,dc=de" --bind-password "xS3Lbd.PuHdmEjAYxQn.JRmaXbuo_2-h" --user-search-base "ou=people,dc=shagohod,dc=de" --user-filter "uid=%s,ou=people,dc=shagohod,dc=de" --email-attribute mail
101
+
102
+# --admin-filter --username-attribute
103
+
93 104
 - name: Add fail2ban script for gitea
94 105
   copy:
95 106
     src=etc_fail2ban_filter.d_gitea.conf

+ 1
- 1
roles/gitea/tasks/main.yml View File

@@ -1 +1 @@
1
-- include: gitea.yml tags=gitea
1
+- include_tasks: gitea.yml

+ 1
- 1
roles/gpodder/tasks/main.yml View File

@@ -1 +1 @@
1
-- include: gpodder.yml tags=gpodder
1
+- include_tasks: gpodder.yml

+ 26
- 19
roles/iot/tasks/influx.yml View File

@@ -15,25 +15,26 @@
15 15
   tags:
16 16
     - dependencies
17 17
 
18
-- name: Install InfluxDB and Telegraf from official repository
19
-  apt:
20
-    name: "{{ packages }}"
21
-    state: present
22
-    update_cache: yes
23
-  vars:
24
-    packages:
25
-    - influxdb
26
-    - telegraf
27
-  tags:
28
-    - dependencies
29
-
30
-- name: Configure InfluxDB
31
-  template:
32
-    src=etc_influxdb_influxdb.j2
33
-    dest=/etc/influxdb/influxdb.conf
34
-    owner=root
35
-    group=root
36
-  notify: restart influxdb
18
+# TODO can no longer run this!
19
+#- name: Install InfluxDB and Telegraf from official repository
20
+#  apt:
21
+#    name: "{{ packages }}"
22
+#    state: present
23
+#    update_cache: yes
24
+#  vars:
25
+#    packages:
26
+#    - influxdb
27
+#    - telegraf
28
+#  tags:
29
+#    - dependencies
30
+#
31
+#- name: Configure InfluxDB
32
+#  template:
33
+#    src=etc_influxdb_influxdb.j2
34
+#    dest=/etc/influxdb/influxdb.conf
35
+#    owner=root
36
+#    group=root
37
+#  notify: restart influxdb
37 38
 
38 39
 - name: Create InfluxDB data directories
39 40
   file: state=directory path={{ item }} owner=influxdb group=influxdb
@@ -58,6 +59,12 @@
58 59
     - 8088  # rpc
59 60
   tags: ufw
60 61
 
62
+# TODO influxdb should get following set in
63
+# /etc/systemd/system/influxdb.service.d/override.conf
64
+#
65
+# [Service]
66
+# TimeoutStartSec=60m
67
+
61 68
 - name: Register new InfluxDB and Telegraf service
62 69
   systemd: name={{ item }} daemon_reload=yes enabled=yes
63 70
   with_items:

+ 6
- 6
roles/iot/tasks/main.yml View File

@@ -1,6 +1,6 @@
1
-- include: grafana.yml tags=iot
2
-- include: influx.yml tags=iot
3
-- include: mosquitto.yml tags=iot
4
-- include: mqtt_admin.yml tags=iot
5
-- include: nodered.yml tags=iot
6
-- include: lights.yml tags=iot
1
+- include_tasks: grafana.yml
2
+- include_tasks: influx.yml
3
+- include_tasks: mosquitto.yml
4
+- include_tasks: mqtt_admin.yml
5
+- include_tasks: nodered.yml
6
+- include_tasks: lights.yml

+ 58
- 58
roles/iot/templates/etc_telegraf_telegraf.j2 View File

@@ -4594,64 +4594,64 @@
4594 4594
 #     # unique_timestamp = "auto"
4595 4595
 
4596 4596
 
4597
-# # Read metrics from MQTT topic(s)
4598
-# [[inputs.mqtt_consumer]]
4599
-#   ## MQTT broker URLs to be used. The format should be scheme://host:port,
4600
-#   ## schema can be tcp, ssl, or ws.
4601
-#   servers = ["tcp://localhost:1883"]
4602
-#
4603
-#   ## QoS policy for messages
4604
-#   ##   0 = at most once
4605
-#   ##   1 = at least once
4606
-#   ##   2 = exactly once
4607
-#   ##
4608
-#   ## When using a QoS of 1 or 2, you should enable persistent_session to allow
4609
-#   ## resuming unacknowledged messages.
4610
-#   qos = 0
4611
-#
4612
-#   ## Connection timeout for initial connection in seconds
4613
-#   connection_timeout = "30s"
4614
-#
4615
-#   ## Maximum messages to read from the broker that have not been written by an
4616
-#   ## output.  For best throughput set based on the number of metrics within
4617
-#   ## each message and the size of the output's metric_batch_size.
4618
-#   ##
4619
-#   ## For example, if each message from the queue contains 10 metrics and the
4620
-#   ## output metric_batch_size is 1000, setting this to 100 will ensure that a
4621
-#   ## full batch is collected and the write is triggered immediately without
4622
-#   ## waiting until the next flush_interval.
4623
-#   # max_undelivered_messages = 1000
4624
-#
4625
-#   ## Topics to subscribe to
4626
-#   topics = [
4627
-#     "telegraf/host01/cpu",
4628
-#     "telegraf/+/mem",
4629
-#     "sensors/#",
4630
-#   ]
4631
-#
4632
-#   # if true, messages that can't be delivered while the subscriber is offline
4633
-#   # will be delivered when it comes back (such as on service restart).
4634
-#   # NOTE: if true, client_id MUST be set
4635
-#   persistent_session = false
4636
-#   # If empty, a random client ID will be generated.
4637
-#   client_id = ""
4638
-#
4639
-#   ## username and password to connect MQTT server.
4640
-#   # username = "telegraf"
4641
-#   # password = "metricsmetricsmetricsmetrics"
4642
-#
4643
-#   ## Optional TLS Config
4644
-#   # tls_ca = "/etc/telegraf/ca.pem"
4645
-#   # tls_cert = "/etc/telegraf/cert.pem"
4646
-#   # tls_key = "/etc/telegraf/key.pem"
4647
-#   ## Use TLS but skip chain & host verification
4648
-#   # insecure_skip_verify = false
4649
-#
4650
-#   ## Data format to consume.
4651
-#   ## Each data format has its own unique set of configuration options, read
4652
-#   ## more about them here:
4653
-#   ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
4654
-#   data_format = "influx"
4597
+# Read metrics from MQTT topic(s)
4598
+[[inputs.mqtt_consumer]]
4599
+  ## MQTT broker URLs to be used. The format should be scheme://host:port,
4600
+  ## schema can be tcp, ssl, or ws.
4601
+  servers = ["tcp://{{ server_fqdn }}:1883"]
4602
+
4603
+  ## QoS policy for messages
4604
+  ##   0 = at most once
4605
+  ##   1 = at least once
4606
+  ##   2 = exactly once
4607
+  ##
4608
+  ## When using a QoS of 1 or 2, you should enable persistent_session to allow
4609
+  ## resuming unacknowledged messages.
4610
+  qos = 0
4611
+
4612
+  ## Connection timeout for initial connection in seconds
4613
+  connection_timeout = "30s"
4614
+
4615
+  ## Maximum messages to read from the broker that have not been written by an
4616
+  ## output.  For best throughput set based on the number of metrics within
4617
+  ## each message and the size of the output's metric_batch_size.
4618
+  ##
4619
+  ## For example, if each message from the queue contains 10 metrics and the
4620
+  ## output metric_batch_size is 1000, setting this to 100 will ensure that a
4621
+  ## full batch is collected and the write is triggered immediately without
4622
+  ## waiting until the next flush_interval.
4623
+  # max_undelivered_messages = 1000
4624
+
4625
+  ## Topics to subscribe to
4626
+  ## matches tasmota "$room/$app/tele/STATE" and "$room/$app/tele/SENSOR"
4627
+  topics = [
4628
+    "+/+/tele/SENSOR",
4629
+    "+/+/tele/STATE",
4630
+  ]
4631
+
4632
+  # if true, messages that can't be delivered while the subscriber is offline
4633
+  # will be delivered when it comes back (such as on service restart).
4634
+  # NOTE: if true, client_id MUST be set
4635
+  persistent_session = false
4636
+  # If empty, a random client ID will be generated.
4637
+  client_id = "iot-mqtt-bridge"
4638
+
4639
+  ## username and password to connect MQTT server.
4640
+  username = "{{ lights_web_username }}"
4641
+  password = "{{ lights_web_password }}"
4642
+
4643
+  ## Optional TLS Config
4644
+  # tls_ca = "/etc/telegraf/ca.pem"
4645
+  # tls_cert = "/etc/telegraf/cert.pem"
4646
+  # tls_key = "/etc/telegraf/key.pem"
4647
+  ## Use TLS but skip chain & host verification
4648
+  # insecure_skip_verify = false
4649
+
4650
+  ## Data format to consume.
4651
+  ## Each data format has its own unique set of configuration options, read
4652
+  ## more about them here:
4653
+  ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
4654
+  data_format = "json"
4655 4655
 
4656 4656
 
4657 4657
 # # Read metrics from NATS subject(s)

+ 1
- 1
roles/ircbouncer/tasks/main.yml View File

@@ -1 +1 @@
1
-- include: znc.yml tags=znc
1
+- include_tasks: znc.yml

+ 1
- 1
roles/jitsi/tasks/main.yml View File

@@ -1,2 +1,2 @@
1 1
 ---
2
-- include: jitsi.yml tags=jitsi
2
+- include_tasks: jitsi.yml

+ 1
- 1
roles/kanboard/tasks/main.yml View File

@@ -1,2 +1,2 @@
1 1
 ---
2
-- include: kanboard.yml tags=kanboard
2
+- include_tasks: kanboard.yml

+ 5
- 1
roles/ldap/DESIGN.md View File

@@ -21,7 +21,11 @@ To setup Nextcloud LDAP login, give it the following credentials:
21 21
     Password: {{ slapd_admin_password }}
22 22
     Base DN: dc=DOMAIN,dc=TLD
23 23
 
24
-Dokuwiki, Jitsi and Kanboard can be configured to use LDAP automatically.
24
+For LimeSurvey, use these settings:
25
+
26
+
27
+
28
+Dokuwiki, Gitea, Jitsi and Kanboard can be configured to use LDAP automatically.
25 29
 See their defaults.
26 30
 
27 31
 ## ToDo

+ 2
- 2
roles/ldap/tasks/main.yml View File

@@ -1,2 +1,2 @@
1
-- include: slapd.yml tags=ldap
2
-- include: fusiondirectory.yml tags=ldap
1
+- include_tasks: slapd.yml
2
+- include_tasks: fusiondirectory.yml

+ 1
- 1
roles/limesurvey/tasks/main.yml View File

@@ -1,2 +1,2 @@
1 1
 ---
2
-- include: limesurvey.yml tags=limesurvey
2
+- include_tasks: limesurvey.yml

+ 7
- 14
roles/mailserver/tasks/main.yml View File

@@ -1,18 +1,11 @@
1 1
 ---
2 2
 # Installs and configures the mail system.
3 3
 
4
-- include: postfix.yml
5
-  tags: postfix
6
-- include: dovecot.yml
7
-  tags: dovecot
8
-- include: rspamd.yml
9
-  tags: rspamd
10
-- include: solr.yml
11
-  tags: solr
12
-- include: checkrbl.yml
13
-  tags: checkrbl
14
-- include: z-push.yml
15
-  tags: zpush
16
-- include: autoconfig.yml
17
-  tags: autoconfig
4
+- include_tasks: postfix.yml
5
+- include_tasks: dovecot.yml
6
+- include_tasks: rspamd.yml
7
+- include_tasks: solr.yml
8
+- include_tasks: checkrbl.yml
9
+- include_tasks: z-push.yml
10
+- include_tasks: autoconfig.yml
18 11
 

+ 1
- 1
roles/mastodon/tasks/main.yml View File

@@ -1 +1 @@
1
-- include: mastodon.yml tags=mastodon
1
+- include_tasks: mastodon.yml

+ 2
- 2
roles/matrix/tasks/main.yml View File

@@ -1,5 +1,5 @@
1 1
 ---
2 2
 # Provides the Synapse Matrix homeserver and the Riot.im client
3 3
 #
4
-- include: riot.yml tags=matrix
5
-- include: synapse.yml tags=matrix
4
+- include_tasks: riot.yml
5
+- include_tasks: synapse.yml

+ 2
- 2
roles/monitoring/tasks/main.yml View File

@@ -1,2 +1,2 @@
1
-- include: monit.yml tags=monit
2
-- include: logwatch.yml tags=logwatch
1
+- include_tasks: monit.yml
2
+- include_tasks: logwatch.yml

+ 1
- 1
roles/news/tasks/main.yml View File

@@ -1 +1 @@
1
-- include: selfoss.yml tags=selfoss
1
+- include_tasks: selfoss.yml

+ 1
- 1
roles/nextcloud/tasks/main.yml View File

@@ -1 +1 @@
1
-- include: nextcloud.yml tags=nextcloud
1
+- include_tasks: nextcloud.yml

+ 1
- 1
roles/rocketchat/tasks/main.yml View File

@@ -1,2 +1,2 @@
1 1
 ---
2
-- include: rocketchat.yml tags=rocketchat
2
+- include_tasks: rocketchat.yml

+ 3
- 3
roles/sslletsencrypt/tasks/main.yml View File

@@ -1,4 +1,4 @@
1 1
 ---
2
-- include: ssl.yml tags=ssl
3
-- include: letsencrypt.yml tags=letsencrypt
4
-- include: ufw.yml tags=ufw
2
+- include_tasks: ssl.yml
3
+- include_tasks: letsencrypt.yml
4
+- include_tasks: ufw.yml

+ 3
- 3
roles/sslselfsigned/tasks/main.yml View File

@@ -1,5 +1,5 @@
1 1
 ---
2 2
 
3
-- include: ssl.yml tags=ssl
4
-- include: selfsigned.yml
5
-- include: ufw.yml tags=ufw
3
+- include_tasks: ssl.yml
4
+- include_tasks: selfsigned.yml
5
+- include_tasks: ufw.yml

+ 1
- 1
roles/vpn/tasks/main.yml View File

@@ -1 +1 @@
1
-- include: openvpn.yml tags=openvpn
1
+- include_tasks: openvpn.yml

+ 1
- 1
roles/webmail/tasks/main.yml View File

@@ -1 +1 @@
1
-- include: roundcube.yml tags=roundcube
1
+- include_tasks: roundcube.yml

Loading…
Cancel
Save