- name: Install required packages
  yum: name={{ item }} state=present
  with_items:
  - python-arrow
  - python-fedora
  - python-requests
  - fedmsg

- name: check log file
  command: stat /var/log/koji-cert-reminder.log
  register: logstat
  always_run: yes
  changed_when: "1 != 1"
  ignore_errors: true

- name: Ensure we can write to our own log file
  file: >
    dest=/var/log/koji-cert-reminder.log
    state=touch
    mode=0644
    owner=fedmsg
    group=fedmsg
  when: logstat.rc == 1

- name: Copy the scripts over
  copy: >
    src=koji-cert-reminder.py
    dest=/usr/local/bin/koji-cert-reminder.py
    mode=0755
    owner=root
    group=root

- name: Copy over the cron definition
  copy: >
    src=koji-cert-reminder.cron
    dest=/etc/cron.d/koji-cert-reminder.cron
    mode=0644
    owner=root
    group=root

- name: Provide some fas credentials to make the query
  template: >
    src=fas_credentials.py
    dest=/etc/fedmsg.d/fas_credentials.py
    mode=0640
    owner=fedmsg
    group=fedmsg
