Parcourir la source

xmpp with support for multiple virtual domains and more sensible default config.

Thomas Buck il y a 5 ans
Parent
révision
07f561e2f5

+ 0
- 7
group_vars/sovereign Voir le fichier

@@ -46,13 +46,6 @@ irc_ident: (required)
46 46
 irc_realname: (required)
47 47
 irc_quitmsg: (required)
48 48
 
49
-# xmpp
50
-prosody_admin: "{{ admin_email }}"
51
-prosody_virtual_domain: "{{ domain }}"
52
-prosody_accounts:
53
-  - name: "{{ main_user_name }}"
54
-    password: TODO
55
-
56 49
 # openvpn
57 50
 openvpn_clients:
58 51
   - laptop

+ 8
- 2
roles/xmpp/defaults/main.yml Voir le fichier

@@ -1,3 +1,9 @@
1
+secret_root: '{{ inventory_dir | realpath }}'
2
+secret_name: 'secret'
3
+secret: '{{ secret_root + "/" + secret_name }}'
4
+
1 5
 prosody_admin: "{{ admin_email }}"
2
-prosody_virtual_domain: "{{ domain }}"
3
-prosody_accounts: []
6
+prosody_accounts:
7
+  - name: "{{ main_user_name }}"
8
+    domain: "{{ domain }}"
9
+    password: "{{ lookup('password', secret + '/' + 'xmpp_main_user_password length=32') }}"

+ 7
- 3
roles/xmpp/tasks/prosody.yml Voir le fichier

@@ -9,8 +9,12 @@
9 9
     - dependencies
10 10
 
11 11
 - name: Install Prosody and dependencies from official repository
12
-  apt: pkg={{ item }} update_cache=yes
13
-  with_items:
12
+  apt:
13
+    name: "{{ packages }}"
14
+    state: present
15
+    update_cache: yes
16
+  vars:
17
+    packages:
14 18
     - prosody
15 19
     - lua-sec
16 20
   tags:
@@ -30,7 +34,7 @@
30 34
   notify: restart prosody
31 35
 
32 36
 - name: Create Prosody accounts
33
-  command: prosodyctl register {{ item.name }} {{ prosody_virtual_domain }} "{{ item.password }}"
37
+  command: prosodyctl register {{ item.name }} {{ item.domain }} "{{ item.password }}"
34 38
   with_items: "{{ prosody_accounts }}"
35 39
 
36 40
 - name: Set firewall rules for Prosody

+ 3
- 1
roles/xmpp/templates/prosody.cfg.lua.j2 Voir le fichier

@@ -152,7 +152,9 @@ data_path = "/data/prosody"
152 152
 -- You need to add a VirtualHost entry for each domain you wish Prosody to serve.
153 153
 -- Settings under each VirtualHost entry apply *only* to that host.
154 154
 
155
-VirtualHost "{{ prosody_virtual_domain }}"
155
+{% for vd in virtual_domains %}
156
+VirtualHost "{{ vd.name }}"
157
+{% endfor %}
156 158
 
157 159
 ------ Components ------
158 160
 -- You can specify components to add hosts that provide special services,

Chargement…
Annuler
Enregistrer