---
- name: Install package for fedmsg-irc
  ansible.builtin.package:
    state: present
    name:
    - python2-fedmsg-meta-fedora-infrastructure
    - fedmsg-irc
    - python-twisted-words
  tags:
  - packages
  - fedmsg/irc

- name: Ensure that nrpe has rights to monitor us
  ansible.builtin.file: >
    dest=/var/run/fedmsg/monitoring-fedmsg-irc.socket
    mode=0775
    owner=fedmsg
    group=nrpe
    state=file
  ignore_errors: true
  tags:
  - fedmsgmonitor

- name: Setup fedmsg-irc config file
  ansible.builtin.template: src=ircbot.py dest=/etc/fedmsg.d/ircbot.py
  tags:
  - config
  - fedmsg/irc
  notify:
  - Restart fedmsg-irc

- name: Setup fas credentials config file
  ansible.builtin.template: >
    src=fas-credentials.py
    dest=/etc/fedmsg.d/fas-credentials.py
    mode=0640
    owner=fedmsg
    group=fedmsg
  tags:
  - config
  - fedmsg/irc
  notify:
  - Restart fedmsg-irc

- name: Enable on boot and start fedmsg-irc
  service: name=fedmsg-irc state=started enabled=true
  tags:
  - services
  - fedmsg/irc
