---
# Configuration for the the-new-hotness consumer

- name: install needed packages
  yum: pkg={{ item }} state=present
  with_items:
  - the-new-hotness
  - python-psycopg2
  - python-sh
  - koji
  - fedpkg
  - git
  - rpmdevtools  # Note that we hotfix rpmdev-bumpspec on top of this
  tags:
  - packages
  - hotness

- name: hotfix rpmdev-bumpspec to a copy from rpmdevtools-8.5-1
  copy: src=hotfix/rpmdev-bumpspec dest=/usr/bin/rpmdev-bumpspec
  tags:
  - hotfix
  - hotness

- name: copy database configuration
  template: >
    src={{ item }} dest=/etc/fedmsg.d/{{ item }}
    owner=fedmsg group=fedmsg mode=0600
  with_items:
  - hotness.py
  notify:
  - restart fedmsg-hub
  tags:
  - config
  - hotness

- name: install hotness.pem koji key and cert
  copy: >
    src="{{ puppet_private }}/hotness_key_and_cert.pem"
    dest="/etc/pki/fedmsg/hotness.pem"
    owner=fedmsg
    group=fedmsg
    mode=0400
  tags:
  - config
  - hotness

- name: install koji ca cert
  copy: >
    src="{{ puppet_private }}/fedora-ca.cert"
    dest="/etc/pki/fedmsg/{{ item }}"
    owner=root
    group=root
    mode=0644
  with_items:
  - fedora-server-ca.cert
  - fedora-upload-ca.cert
  tags:
  - config
  - hotness

- name: Copy over a yum config for repoquery
  copy: src=yumconfig dest=/etc/hotness-yum.conf
  tags:
  - config
  - hotness

- name: Copy over rpmmacros configuration
  copy: src=rpmmacros dest=/etc/rpm/macros.hotness
  tags:
  - config
  - hotness

- name: Drop old /usr/share/fedmsg (once used for bugzilla cookies...)
  file: dest=/usr/share/fedmsg state=absent
  tags:
  - hotness
