prosody/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Sat, 16 Sep 2023 01:39:37 -0500
changeset 223 de03976c2df1
parent 138 591b6609fc64
child 237 c6c11084c802
permissions -rw-r--r--
Unifi-7.5 release doesnt seem to support arm so I held the version at 7.4.

---

- name: install prosody
  become: yes
  apt: name="{{item}}"
  notify: restart prosody
  loop:
    - "prosody"
    - "lua-dbi-postgresql"

- name: configure prosody
  become: yes
  template:
    src: "prosody.cfg.lua.j2"
    dest: "/etc/prosody/conf.avail/{{prosody_vhost}}.cfg.lua"
  notify: restart prosody

- name: install prosody site
  become: yes
  template: src="prosody.cfg.lua.j2" dest="/etc/prosody/conf.avail/{{prosody_vhost}}.cfg.lua"
  notify: restart prosody

- name: install letsencrypt ssl deploy hook
  become: yes
  copy:
    src: "prosody.sh"
    dest: "/etc/letsencrypt/renewal-hooks/deploy/prosody.sh"
    mode: "0755"

- name: run letsencrypt ssl deploy hook
  become: yes
  command: "/etc/letsencrypt/renewal-hooks/deploy/prosody.sh"
  notify: restart prosody

- name: install db schema file
  become: yes
  template:
    src: "setup_db.psql.j2"
    dest: "/tmp/setup_db_{{prosody_db}}.psql"
    owner: "postgres"
    group: "postgres"
    mode: "0600"
  changed_when: false

- name: install psql
  become: yes
  become_user: "postgres"
  command: "psql -f /tmp/setup_db_{{prosody_db}}.psql"
  changed_when: false

- name: enable prosody site
  become: yes
  file:
    src:  "/etc/prosody/conf.avail/{{prosody_vhost}}.cfg.lua"
    dest: "/etc/prosody/conf.d/{{prosody_vhost}}.cfg.lua"
    state: "link"
  notify: restart prosody