prosody/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 12 Feb 2024 17:29:16 -0600
changeset 232 a447e60bd3e9
parent 138 591b6609fc64
child 237 c6c11084c802
permissions -rw-r--r--
Version updates
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
138
591b6609fc64 Use proper ssl cert config for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 45
diff changeset
    23
- name: install letsencrypt ssl deploy hook
44
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:
138
591b6609fc64 Use proper ssl cert config for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 45
diff changeset
    26
    src: "prosody.sh"
591b6609fc64 Use proper ssl cert config for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 45
diff changeset
    27
    dest: "/etc/letsencrypt/renewal-hooks/deploy/prosody.sh"
591b6609fc64 Use proper ssl cert config for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 45
diff changeset
    28
    mode: "0755"
591b6609fc64 Use proper ssl cert config for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 45
diff changeset
    29
591b6609fc64 Use proper ssl cert config for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 45
diff changeset
    30
- name: run letsencrypt ssl deploy hook
591b6609fc64 Use proper ssl cert config for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 45
diff changeset
    31
  become: yes
591b6609fc64 Use proper ssl cert config for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 45
diff changeset
    32
  command: "/etc/letsencrypt/renewal-hooks/deploy/prosody.sh"
44
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    33
  notify: restart prosody
aaf10cecfc1f Copy prosody keys over.
Luke Hoersten <luke@hoersten.org>
parents: 23
diff changeset
    34
45
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    35
- name: install db schema file
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    36
  become: yes
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    37
  template:
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    38
    src: "setup_db.psql.j2"
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    39
    dest: "/tmp/setup_db_{{prosody_db}}.psql"
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    40
    owner: "postgres"
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    41
    group: "postgres"
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    42
    mode: "0600"
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    43
  changed_when: false
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    44
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    45
- name: install psql
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    46
  become: yes
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    47
  become_user: "postgres"
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    48
  command: "psql -f /tmp/setup_db_{{prosody_db}}.psql"
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    49
  changed_when: false
2d7ba960b157 Added postgresql for prosody.
Luke Hoersten <luke@hoersten.org>
parents: 44
diff changeset
    50
23
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    51
- name: enable prosody site
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    52
  become: yes
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    53
  file:
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    54
    src:  "/etc/prosody/conf.avail/{{prosody_vhost}}.cfg.lua"
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    55
    dest: "/etc/prosody/conf.d/{{prosody_vhost}}.cfg.lua"
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    56
    state: "link"
b4ad03deace1 Added prosody role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    57
  notify: restart prosody