- name: install packages
  package: name={{ item }} state=present
  with_items:
  - koschei-frontend
  - koschei-frontend-fedora
  - koschei-frontend-copr
  - mod_auth_openidc
  tags:
  - koschei
  - packages

- name: install config files
  template: >
    src="{{ item }}.j2"
    dest="/etc/koschei/{{ item }}"
    owner=koschei
    group=koschei
    mode=0400
  with_items:
  - config-frontend.cfg
  notify:
  - reload httpd
  tags:
  - koschei
  - config

- name: install httpd config file
  template: >
    src="httpd.conf.j2"
    dest="/etc/httpd/conf.d/koschei.conf"
  notify:
  - reload httpd
  tags:
  - koschei
  - config

- name: set httpd selinux booleans
  seboolean: name={{ item }} state=yes persistent=yes
  with_items:
  - httpd_can_network_connect
  - httpd_can_network_connect_db
  - httpd_can_network_memcache
  - httpd_execmem
  notify:
  - reload httpd
  tags:
  - koschei
  - selinux

- name: enable httpd to start on boot
  service: name=httpd state=started enabled=true
  tags:
  - koschei
  - service

- name: create directory for hotfix_pagure_extras plugin
  file: name=/usr/lib/python3.7/site-packages/koschei/plugins/hotfix_pagure_extras_plugin state=directory
  tags:
  - koschei
  - hotfix

- name: install hotfix_pagure_extras plugin
  copy: src=hotfix_pagure_extras_plugin.py dest=/usr/lib/python3.7/site-packages/koschei/plugins/hotfix_pagure_extras_plugin/frontend.py
  notify:
  - reload httpd
  tags:
  - koschei
  - hotfix
