Browse Source

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

Thomas Buck 5 years ago
parent
commit
07f561e2f5

+ 0
- 7
group_vars/sovereign View File

46
 irc_realname: (required)
46
 irc_realname: (required)
47
 irc_quitmsg: (required)
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
 # openvpn
49
 # openvpn
57
 openvpn_clients:
50
 openvpn_clients:
58
   - laptop
51
   - laptop

+ 8
- 2
roles/xmpp/defaults/main.yml View File

1
+secret_root: '{{ inventory_dir | realpath }}'
2
+secret_name: 'secret'
3
+secret: '{{ secret_root + "/" + secret_name }}'
4
+
1
 prosody_admin: "{{ admin_email }}"
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 View File

9
     - dependencies
9
     - dependencies
10
 
10
 
11
 - name: Install Prosody and dependencies from official repository
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
     - prosody
18
     - prosody
15
     - lua-sec
19
     - lua-sec
16
   tags:
20
   tags:
30
   notify: restart prosody
34
   notify: restart prosody
31
 
35
 
32
 - name: Create Prosody accounts
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
   with_items: "{{ prosody_accounts }}"
38
   with_items: "{{ prosody_accounts }}"
35
 
39
 
36
 - name: Set firewall rules for Prosody
40
 - name: Set firewall rules for Prosody

+ 3
- 1
roles/xmpp/templates/prosody.cfg.lua.j2 View File

152
 -- You need to add a VirtualHost entry for each domain you wish Prosody to serve.
152
 -- You need to add a VirtualHost entry for each domain you wish Prosody to serve.
153
 -- Settings under each VirtualHost entry apply *only* to that host.
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
 ------ Components ------
159
 ------ Components ------
158
 -- You can specify components to add hosts that provide special services,
160
 -- You can specify components to add hosts that provide special services,

Loading…
Cancel
Save