---
- name: ensure required packages are present
  apt:
    pkg: mumble-server

- name: generate the Murmur config file
  template:
    src: "mumble-server.ini.j2"
    dest: "/etc/mumble-server.ini"
    owner: root
    group: mumble-server
    mode: 0640
  notify: restart murmur

- name: always start service
  service:
    name: mumble-server
    enabled: True
    state: started

- name: write superuser password to a file
  copy:
    content: "{{ murmur_superuser_password }}"
    dest: /etc/mumble-superuser
    owner: root
    group: root
    mode: 0600
  when: murmur_superuser_password is defined
  notify: set superuser password