---
# Configuration for the Fedora Notifications webapp

- name: install needed packages
  dnf: pkg={{ item }} state=present
  with_items:
  - autocloud-common
  - autocloud-web
  - python-sqlalchemy
  - python-sqlalchemy-utils
  - python2-flask-restless
  - libsemanage-python
  notify:
  - restart apache
  tags:
  - autocloud
  - autocloud/frontend

- name: copy autocloud dashboard configuration
  template: >
    src={{ item }} dest=/etc/autocloud/{{ item }}
    owner=apache group=apache mode=0600
  with_items:
  - autocloud.cfg
  notify:
  - restart apache
  tags:
  - autocloud
  - autocloud/frontend

- name: copy autocloud httpd config
  template: >
    src=autocloud.conf dest=/etc/httpd/conf.d/autocloud.conf
    owner=apache group=apache mode=0644
  notify:
  - restart apache
  tags:
  - autocloud
  - autocloud/frontend

- name: setup symlink to fedora theme
  file: >
    src=/usr/share/autocloud/static/bootstrap-3.3.4-fedora
    dest=/usr/share/autocloud/static/bootstrap
    state=link
  tags:
  - autocloud
  - autocloud/frontend

- name: apply selinux type to static files
  file: >
    dest=/usr/share/autocloud/static
    setype=httpd_sys_content_t
    state=directory
    recurse=yes
  tags:
  - autocloud
  - autocloud/frontend
  - selinux

- name: ensure selinux lets httpd talk to postgres.
  seboolean: name={{item}} state=yes persistent=yes
  with_items:
  - httpd_can_network_connect_db
  tags:
  - autocloud
  - autocloud/frontend
  - selinux
