---
# Configuration for the plus-plus-service webapp

- name: Ensure mod_wsgi is not installed since we're using python3
  dnf: pkg=mod_wsgi state=absent
  tags:
  - pps
  - packages

- name: Ensure there are no left over of mod_wsgi
  file: path=/etc/httpd/conf.d/wsgi.conf state=absent
  tags:
  - pps
  - config

- name: install needed packages
  dnf: pkg={{ item }} state=present
  with_items:
  - plus-plus-service
  - python3-mod_wsgi
  - python3-psycopg2
  tags:
  - pps
  - packages

- name: create all the directory for the configuration file
  file: state=directory path=/etc/plus-plus-service
  tags:
  - pps
  - config

- name: Install the config files
  template: src={{ item.src }}
            dest={{ item.dest }}
  with_items:
  - { src: 'settings.py', dest: /etc/plus-plus-service/settings.py }
  - { src: 'apache.conf', dest: /etc/httpd/conf.d/plus-plus-service.conf }
  tags:
  - pps
  - config
  notify:
  - reload httpd
