- name: install nrpe checks
  template: src=copr_backend_nrpe.cfg dest=/etc/nrpe.d/copr_backend_nrpe.cfg
  notify:
  - restart nrpe
  tags:
  - nagios_client

- name: set acl for nrpe on /etc/copr
  acl: name=/etc/copr entity=nrpe etype=user permissions=rx state=present

- name: set acl for nrpe on /etc/copr/copr-be.conf
  acl: name=/etc/copr/copr-be.conf entity=nrpe etype=user permissions=r state=present

# Three tasks for handling our custom selinux module
- name: ensure a directory exists for our custom selinux module
  file: dest=/usr/local/share/copr state=directory

- name: copy over our custom selinux module
  copy: src=selinux/nrpe_copr.pp dest=/usr/local/share/copr/fedmsg.pp
  register: selinux_module

- name: install our custom selinux module
  command: semodule -i /usr/local/share/copr/fedmsg.pp
  when: selinux_module|changed
