---
- name: start httpd (provided in the apache role)
  service: name=httpd state=started

- name: ensure packages required for resultsdb_frontend are installed (dnf)
  dnf: name={{ item }} state=present
  with_items:
    - resultsdb_frontend
    - python3-mod_wsgi
  when: ansible_cmdline.ostree is not defined and deployment_type in ['dev', 'stg']

###########
## TODO: remove when transition to buildbot 1.7 is complete
- name: ensure packages required for resultsdb_frontend are installed (dnf)
  dnf: name={{ item }} state=present
  with_items:
    - resultsdb_frontend
    - mod_wsgi
  when: ansible_cmdline.ostree is not defined and deployment_type in ['prod']
###########

- name: ensure selinux lets httpd talk to the network
  seboolean: name=httpd_can_network_connect persistent=yes state=yes

- name: generate resultsdb_frontend config
  template: src=settings.py.j2 dest=/etc/resultsdb_frontend/settings.py owner=root group=root mode=0644
  notify:
    - reload 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:
    - reload httpd
