---
- name: install needed packages for blockerbugs
  package: state=present name={{ item }} enablerepo=epel-testing
  with_items:
  - libsemanage-python
  - python-psycopg2
  - python-kitchen
  - python-alembic
  - python-flask-wtf
  - python-flask
  - python-sqlalchemy
  - python-fedora-flask
  - python-wtforms
  - python-fedora
  - pytest
  - python-lxml
  - python-flask-sqlalchemy
  - python-bugzilla
  - blockerbugs
  - python-bunch
  tags:
  - packages
  - blockerbugs

- name: setup blockerbugs apache conf
  copy: src=blockerbugs.conf dest=/etc/httpd/conf.d/blockerbugs.conf mode=644
  notify:
  - reload httpd
  tags:
  - config
  - httpd
  - blockerbugs

- name: setup blockerbugs app settings file
  template: src=blockerbugs-settings.py.j2 dest=/etc/blockerbugs/settings.py mode=640
  notify:
  - reload httpd
  tags:
  - config
  - httpd
  - blockerbugs

- name: grant blockerbugs and apache read access to the settings file
  acl: name=/etc/blockerbugs/settings.py entity={{ item }} etype=user permissions="r" state=present
  with_items:
  - blockerbugs
  - apache
  notify:
  - reload httpd
  tags:
  - config
  - httpd
  - blockerbugs

- name: set sebooleans so blockerbugs can talk to the db
  seboolean: name=httpd_can_network_connect_db state=true persistent=true
  tags:
  - config
  - blockerbugs

- name: setup blockerbugs cron (master node only)
  copy: src=blockerbugs.cron dest=/etc/cron.d/blockerbugs
  when: master_blockerbugs_node
  tags:
  - config
  - blockerbugs
