initial commit
This commit is contained in:
commit
13eace9ce9
219 files changed
+6918
No files matched your search
@@ -0,0 +1,66 @@
|
||||
---
|
||||
- name: install prosody
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- prosody
|
||||
- lua-dbi-postgresql
|
||||
- prosody-modules
|
||||
state: present
|
||||
update_cache: yes
|
||||
notify:
|
||||
- restart prosody
|
||||
|
||||
- name: fetch wan ip
|
||||
ansible.builtin.shell: ssh -o StrictHostKeyChecking=no root@{{ hostvars['router'].ip }} "ip -4 addr show eth1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'"
|
||||
delegate_to: localhost
|
||||
register: router_wan_ip
|
||||
changed_when: false
|
||||
vars:
|
||||
ansible_connection: local
|
||||
|
||||
- name: ensure prosody data directory is a mountpoint
|
||||
ansible.builtin.command: mountpoint -q /var/lib/prosody
|
||||
register: vw_mountpoint
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
|
||||
- name: remove default prosody data directory
|
||||
ansible.builtin.file:
|
||||
path: /var/lib/prosody
|
||||
state: absent
|
||||
when: vw_mountpoint.rc != 0
|
||||
|
||||
- name: ensure prosody data source directory exists
|
||||
ansible.builtin.file:
|
||||
path: /mnt/prosody/data
|
||||
state: directory
|
||||
owner: prosody
|
||||
group: prosody
|
||||
mode: "0755"
|
||||
|
||||
- name: bind mount prosody data directory
|
||||
ansible.posix.mount:
|
||||
path: /var/lib/prosody
|
||||
src: /mnt/prosody/data
|
||||
fstype: none
|
||||
opts: bind
|
||||
state: mounted
|
||||
notify: restart prosody
|
||||
|
||||
- name: set prosody data directory ownership
|
||||
ansible.builtin.file:
|
||||
path: /mnt/prosody/data
|
||||
owner: prosody
|
||||
group: prosody
|
||||
recurse: true
|
||||
|
||||
- name: deploy prosody config
|
||||
ansible.builtin.template:
|
||||
src: "{{ inventory_hostname }}/prosody.cfg.lua.j2"
|
||||
dest: "/etc/prosody/prosody.cfg.lua"
|
||||
owner: prosody
|
||||
group: root
|
||||
mode: '0640'
|
||||
vars:
|
||||
wan_ip: "{{ router_wan_ip.stdout }}"
|
||||
notify: restart prosody
|
||||
Reference in new issue
Block a user