prosody/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Wed, 01 Jul 2020 14:51:38 -0500
changeset 107 9057b9f9ced8
parent 45 2d7ba960b157
child 138 591b6609fc64
permissions -rw-r--r--
MC separate world files dont work. Had to move main dir.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: install prosody
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
45
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
     5
  apt: name="{{item}}"
23
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
  notify: restart prosody
45
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
     7
  loop:
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
     8
    - "prosody"
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
     9
    - "lua-dbi-postgresql"
23
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
- name: configure prosody
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
  become: yes
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
  template:
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
    src: "prosody.cfg.lua.j2"
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
    dest: "/etc/prosody/conf.avail/{{prosody_vhost}}.cfg.lua"
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
  notify: restart prosody
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
- name: install prosody site
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
  become: yes
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
  template: src="prosody.cfg.lua.j2" dest="/etc/prosody/conf.avail/{{prosody_vhost}}.cfg.lua"
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
  notify: restart prosody
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
44
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    23
- name: copy ssl keys
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    24
  become: yes
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    25
  copy:
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    26
    src: "{{item}}"
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    27
    dest: "{{prosody_ssl_dir}}/"
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    28
    remote_src: yes
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    29
    mode: "0640"
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    30
    owner: "root"
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    31
    group: "prosody"
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    32
  notify: restart prosody
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    33
  loop:
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    34
    - "{{prosody_ssl_privkey_src}}"
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    35
    - "{{prosody_ssl_cert_src}}"
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    36
45
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    37
- name: install db schema file
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    38
  become: yes
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    39
  template:
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    40
    src: "setup_db.psql.j2"
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    41
    dest: "/tmp/setup_db_{{prosody_db}}.psql"
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    42
    owner: "postgres"
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    43
    group: "postgres"
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    44
    mode: "0600"
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    45
  changed_when: false
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    46
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    47
- name: install psql
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    48
  become: yes
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    49
  become_user: "postgres"
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    50
  command: "psql -f /tmp/setup_db_{{prosody_db}}.psql"
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    51
  changed_when: false
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    52
23
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    53
- name: enable prosody site
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    54
  become: yes
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    55
  file:
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    56
    src:  "/etc/prosody/conf.avail/{{prosody_vhost}}.cfg.lua"
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    57
    dest: "/etc/prosody/conf.d/{{prosody_vhost}}.cfg.lua"
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    58
    state: "link"
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    59
  notify: restart prosody