prosody/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Sun, 28 Jun 2020 15:08:36 -0500
changeset 54 1ea4f1c7c675
parent 45 2d7ba960b157
child 138 591b6609fc64
permissions -rw-r--r--
Updated client templating in adguard.

---

- 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: copy ssl keys
  become: yes
  copy:
    src: "{{item}}"
    dest: "{{prosody_ssl_dir}}/"
    remote_src: yes
    mode: "0640"
    owner: "root"
    group: "prosody"
  notify: restart prosody
  loop:
    - "{{prosody_ssl_privkey_src}}"
    - "{{prosody_ssl_cert_src}}"

- 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