- 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:
  - fedoraloveskde.org
  tags:
  - fedoraloveskde

- name: Copy syncfedoraloveskde script (stg)
  when: env == "staging"
  copy:
    src: sync{{item}}.stg.sh
    dest: /usr/local/bin/sync{{item}}
    owner: root
    group: root
    mode: 0755
  with_items:
  - fedoraloveskde
  tags:
  - fedoraloveskde

- name: Copy syncfedoraloveskde script (prod)
  when: env == "production"
  copy:
    src: "{{item}}.sh"
    dest: "/usr/local/bin/{{item}}"
    owner: root
    group: root
    mode: 0755
  with_items:
  - syncfedoraloveskde
  tags:
  - fedoraloveskde

- name: Install the syncfedoraloveskde cron job
  copy:
    src: "{{item}}.cron"
    dest: "/etc/cron.d/{{item}}.cron"
    owner: root
    group: root
    mode: 0644
  with_items:
  - syncfedoraloveskde
  tags:
  - fedoraloveskde
  - cron
