- name: ensure packages required for resultsdb_frontend are installed
  action: yum name={{ item }} state=latest
  when: deployment_type == 'prod' or deployment_type == 'local'
  with_items:
    - resultsdb_frontend
    - mod_wsgi

- name: ensure packages required for resultsdb_frontend are installed (infra-testing)
  action: yum name={{ item }} state=latest enablerepo=infrastructure-testing
  when: deployment_type == 'dev' or deployment_type == 'stg'
  with_items:
    - resultsdb_frontend
    - mod_wsgi

- name: generate resultsdb_frontend config
  template: src=settings.py.j2 dest=/etc/resultsdb_frontend/settings.py owner=root group=root mode=0644
  notify:
    - restart httpd

- name: generate resultsdb_frontend apache config
  template: src=resultsdb_frontend.conf.j2 dest=/etc/httpd/conf.d/resultsdb_frontend.conf owner=root group=root mode=0644
  notify:
    - restart httpd
