- name: install fedmsg-gateway
  package: name=fedmsg-gateway state=present
  tags:
  - packages
  - fedmsg/gateway

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

- name: setup fedmsg-gateway config file
  copy: src=gateway.py dest=/etc/fedmsg.d/gateway.py
  tags:
  - config
  - fedmsg/gateway
  notify:
  - restart fedmsg-gateway

- name: create systemd drop-in directory
  file: >
    dest=/etc/systemd/system/fedmsg-gateway.service.d
    state=directory
  tags:
  - fedmsg/gateway

- name: bump fs limits by installing a drop-in systemd config
  copy: >
    src=fs-limits.conf
    dest=/etc/systemd/system/fedmsg-gateway.service.d/fs-limits.conf
  tags:
  - config
  - fedmsg/gateway
  notify:
  - restart fedmsg-gateway

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