---
- name: Install libOTR
  pacman: name=libotr state=present

- name: Install Bitlbee
  pacman: name=bitlbee state=present

- name: Push Bitlbee configuration file
  template: src=bitlbee.conf.j2 dest=/etc/bitlbee/bitlbee.conf

- name: Ensure proper ownership of configuration directory
  file: path=/var/lib/bitlbee group=bitlbee owner=bitlbee

- name: Create Bitlbee systemd unit file directory
  file: path=/etc/systemd/system/bitlbee.service.d state=directory
  tags:
    - firejail

- name: Push Bitlbee socket unit file
  copy: src=bitlbee-service-override.conf dest=/etc/systemd/system/bitlbee.service.d/override.conf
  notify:
    - reload systemd config
    - restart bitlbee
  tags:
    - firejail

- include_tasks: roles/nmtrust/tasks/unit.yml
  vars:
      unit: bitlbee.service
      run_on: "{{ bitlbee.run_on }}"
