---
- name: install python-pandas package
  package: state=present name=python-pandas
  tags:
  - packages
  - web-data

- name: make sure the /usr/local/share/web-data-analysis exists
  file: path=/usr/local/share/web-data-analysis state=directory
  tags:
    - web-data

- name: make the data directory
  file: path=/mnt/fedora_stats/data state=directory mode=0755
  tags:
    - web-data

- name: make the data subdirs
  file: path=/mnt/fedora_stats/data/{{item}} state=directory mode=0755
  with_items: [getfedora, hotspot, mirrors, start]
  tags:
    - web-data

- name: copy over website index.
  copy: src=html/main-index.html dest=/var/www/html/index.html mode=0644
  tags:
    - web-data

- name: make a css tree
  file: path=/var/www/html/css/  state=directory mode=0755
  tags:
    - web-data


- name: css files
  copy: src={{item}} dest=/var/www/html/css/ mode=0644
  with_items: [ html/css/awstats-reports.css,  html/css/normalize.css ]
  tags:
    - web-data

- name: make an awstats directory
  file: path=/var/www/html/awstats-reports/  state=directory mode=0755
  tags:
    - web-data

- name: copy over its index
  copy: src=html/awstats-index.html  dest=/var/www/html/awstats-reports/index.html mode=0644
  tags:
    - web-data

- name: make the web directory exists
  file: path=/var/www/html/csv-reports/  state=directory mode=0755
  tags:
    - web-data

- name: make the web subdirs
  file: path=/var/www/html/csv-reports/{{item}} state=directory mode=0755
  with_items: [images, getfedora, hotspot, mirrors, start]
  tags:
    - web-data

- name: make the web directory summary.
  copy: src=html/summary.html dest=/var/www/html/csv-reports/images/ mode=0644
  tags:
    - web-data

- name: scripts to condense data down for further processing
  copy: src={{item}} dest=/usr/local/bin/ mode=0755
  with_items: [condense-mirrorlogs.sh, condense-getfedoralogs.sh, run-daily-awstats.sh, condense-hotspot.sh ]
  tags:
    - web-data

- name: python scripts to calculate various data
  copy: src={{item}} dest=/usr/local/bin/ mode=0755
  with_items: [mirrorlist.py, mirrors-moving_avg.py, hotspot-moving_avg.py]
  tags:
    - web-data

- name: awk files for csv creation
  copy: src={{item}} dest=/usr/local/share/web-data-analysis mode=0644
  with_items: [mirrors-data.awk, getfedora-data.awk, getfedora.awk, hotspot-data.awk, hotspot.awk ]
  tags:
    - web-data

- name: gnuplot file for image creation
  copy: src={{item}} dest=/usr/local/share/web-data-analysis mode=0644
  with_items: [ mirrors-data.gp, getfedora-data.gp, mirrors-moving.gp, hotspot.gp ]
  tags:
    - web-data

- name: daily cron file to run the log files
  copy: src={{item}} dest=/etc/cron.d/ mode=0644
  with_items: [condense-mirrorlogs.cron, condense-getfedoralogs.cron, run-daily-awstats.cron, condense-hotspot.cron]
  tags:
    - web-data
    - cron

- name: copy over the httpd config to lock kerberos
  copy: src=httpd_config.conf dest=/etc/httpd/conf.d/krb_config.conf mode=0644
  tags:
    - web-data
