---
- name: Dependencies installed
  community.general.pkgng:
    name: dendrite
    state: latest

- name: Dendrite enabled
  shell: sysrc dendrite_enable="YES"
  notify: Dendrite restarted

- name: Matrix signing key installed
  template:
    src: matrix_key.pem.j2
    dest: /usr/local/etc/dendrite/matrix_key.pem
    owner: root
    mode: 0600
  notify: Dendrite restarted

- name: Dendrite config installed
  template:
    src: dendrite.yaml.j2
    dest: /usr/local/etc/dendrite/dendrite.yaml
    owner: root
    mode: 0600
  notify: Dendrite restarted

- name: Ensure dendrite is running
  service:
    name: dendrite
    state: started
