- name: ensure packages required for taskotron-trigger are installed
  action: yum name={{ item }} state=latest
  with_items:
    - fedmsg
    - fedmsg-hub
    - taskotron-trigger
    # needed for cron script
    - resultsdb_api

- name: generate trigger configuration
  template: src=trigger.cfg.j2 dest=/etc/taskotron/trigger.cfg owner=root group=root mode=0744
  notify:
  - restart fedmsg-hub

- name: copy fedmsg logging configuration
  copy: src=logging.py dest=/etc/fedmsg.d/logging.py owner=root group=root mode=0744
  notify:
  - restart fedmsg-hub

- name: install fetch_activity
  copy: src=fetch_activity.py dest=/root/fetch_activity.py owner=root group=root mode=0644

- name: create a dir for fetch_activity logs
  file: dest=/root/fetch_activity_logs mode=755 owner=root group=root state=directory

- name: copy fetch_activity cron job
  template: src=fetch_activity.cron.j2 dest=/etc/cron.d/fetch_activity.cron owner=root group=root mode=0644
  notify:
  - restart crond

- name: start and enable fedmsg-hub service
  service: name=fedmsg-hub enabled=yes state=started
