- name: install needed packages
  package: name={{ item }} state=present
  with_items:
  - basset-frontend
  tags:
  - basset
  - basset/frontend

- name: start httpd
  service: name=httpd state=started

- name: install basset config
  template: src=frontend.cfg.j2 dest=/etc/basset/frontend.cfg
            owner=basset-frontend group=basset-frontend mode=0600
  notify:
  - restart apache
  tags:
  - basset
  - basset/frontend

- name: install staging htpasswd
  copy: src={{private}}/files/httpd/basset.stg.htpasswd dest=/etc/httpd/conf.d/basset.htpasswd
        owner=root group=root mode=0644
  when: env == "staging"
  notify:
  - restart apache
  tags:
  - basset
  - basset/frontend

- name: install prod htpasswd
  copy: src={{private}}/files/httpd/basset.prod.htpasswd dest=/etc/httpd/conf.d/basset.htpasswd
        owner=root group=root mode=0644
  when: env != "staging"
  notify:
  - restart apache
  tags:
  - basset
  - basset/frontend

- name: set sebooleans so basset-frontend can talk to the broker
  seboolean: name=httpd_can_network_connect
                    state=true
                    persistent=true
  tags:
  - basset
  - basset/frontend
  - selinux

- name: install frontend config
  copy: src=basset.conf dest=/etc/httpd/conf.d/basset.conf
        owner=root group=root mode=0644
  notify:
  - restart apache
  tags:
  - basset
  - basset/frontend
