---
- name: ensure packages required for taskotron-frontend are installed (yum)
  package: name={{ item }} state=present
  with_items:
    - httpd
  when: ansible_distribution_major_version|int < 22

- name: ensure packages required for taskotron-frontend are installed (dnf)
  dnf: name={{ item }} state=present
  with_items:
    - httpd
  when: ansible_distribution_major_version|int > 21 and ansible_cmdline.ostree is not defined

- name: create dirs for static files
  file: path=/var/www/html/{{ item }} state=directory owner=apache group=apache mode=1755
  with_items:
    - 'static/'
    - 'static/img'
    - 'static/css'
    - 'static/fonts'

- name: copy static bits
  copy: src=static/ dest=/var/www/html/static owner=apache group=apache mode=0644

#- name: copy fonts
  #copy: src={{ bigfiles }}/fonts dest=/var/www/html/static/ owner=apache group=apache mode=0644

- name: generate landing page
  template: src={{ item }} dest=/var/www/html/index.html owner=apache group=apache mode=0644
  with_first_found:
    - 'landingpage.html.j2.{{ deployment_type }}'
    - 'landingpage.html.j2'
