- name: Install that apps-fp-o rpm package
  package: name=apps-fp-o state=present
  tags:
  - apps-fp-o

- name: Copy in the proxy config
  copy: >
    src=apps.fp.o.conf dest=/etc/httpd/conf.d/{{website}}/apps.fp.o.conf
    owner=root group=root mode=0644
  notify:
  - reload proxyhttpd
  tags:
  - apps-fp-o

- name: Ensure directory exixts
  file:
    path: "{{ item }}"
    state: directory
    mode: '2755'
  loop:
    - '/srv/web/apps-fp-o/global/'
    - '/srv/web/apps-fp-o/img/icons/'
    - '/srv/web/apps-fp-o/fedmenu/'
  tags:
  - apps-fp-o

- name: Copy over any extra icons we carry
  synchronize: src=img/icons/ dest=/srv/web/apps-fp-o/img/icons/
  tags:
  - apps-fp-o

- name: Copy in some extra global assets (openid.js, fedora-boostrap...) used around our apps
  synchronize: src=global/ dest=/srv/web/apps-fp-o/global/
  tags:
  - apps-fp-o

- name: Copy in fedmenu assets for staging
  synchronize: src=fedmenu-staging/ dest=/srv/web/apps-fp-o/fedmenu/
  when: env == 'staging'
  tags:
  - apps-fp-o

- name: Copy in fedmenu assets for production
  synchronize: src=fedmenu/ dest=/srv/web/apps-fp-o/fedmenu/
  when: env != 'staging'
  tags:
  - apps-fp-o

- name: Copy in our app data yaml
  copy: >
    src=apps.yaml dest=/usr/share/apps-fp-o/apps.yaml
    owner=root group=root mode=0644
  notify:
  - rebuild apps-fp-o html
  - rebuild apps-fp-o json
  tags:
  - apps-fp-o
