- name: Install needed packages
  package: name={{ item }} state=present
  with_items:
  - babel
  - git
  - python-feedparser
  - python-genshi
  - python-setuptools
  - zanata-python-client
  tags:
  - packages
  - fedora-web

- name: Install extra packages for staging
  package: name={{ item }} state=present
  with_items:
  - python-dogpile-cache
  tags:
  - packages
  - fedora-web

- name: Create file to indicate we want live fedimg data
  copy: dest=/var/fedora_websites_live_fedimg
        content="Indicator file"
  tags:
  - fedora-web

- name: Create directories
  file: state=directory
        path=/srv/web/{{item}}
        owner=apache group=apache mode=0755
        setype=httpd_sys_content_t seuser=system_u
  with_items:
  - fedora-web
  - fedoraproject.org
  - boot.fedoraproject.org
  - spins.fedoraproject.org
  - talk.fedoraproject.org
  - start.fedoraproject.org
  - mirrors.fedoraproject.org
  - fedoracommunity.org
  - fudcon.fedoraproject.org
  - getfedora.org
  - flocktofedora.org
  - arm.fedoraproject.org
  - iot.fedoraproject.org
  - labs.fedoraproject.org
  tags:
  - fedora-web

- name: make fmw dir
  file: state=directory path=/srv/web/fmw owner=apache group=sysadmin-releng mode=2775 setype=httpd_sys_content_t seuser=system_u
  tags:
  - fedora-web

- name: Copy syncStatic script (stg)
  when: env == "staging"
  copy: >
    src=syncStatic.stg.sh dest=/usr/local/bin/syncStatic owner=root group=root
    mode=0755
  tags:
  - fedora-web

- name: Copy syncStatic script (prod)
  when: env == "production"
  copy: >
    src=syncStatic.sh dest=/usr/local/bin/syncStatic owner=root group=root
    mode=0755
  tags:
  - fedora-web

- name: Copy syncTranslations script (stg)
  when: env == "staging"
  copy: >
    src=syncTranslations.stg.sh dest=/usr/local/bin/syncTranslations.sh owner=root
    group=root mode=0755
  tags:
  - fedora-web

- name: Copy syncTranslations script (prod)
  when: env == "production"
  copy: >
    src=syncTranslations.sh dest=/usr/local/bin/syncTranslations.sh owner=root
    group=root mode=0755
  tags:
  - fedora-web

- name: Install the syncStatic and syncTranslations cronjobs
  copy: >
    src={{item}}.cron dest=/etc/cron.d/{{item}}.cron
    owner=root group=root mode=0644
  with_items:
  - syncStatic
  - syncTranslations
  tags:
  - fedora-web
  - cron
