---

- name: Check mageia-docker mandatory packages installed
  urpmi: name={{ item.pkg }} state=installed update_cache=yes no-recommends=yes
  with_items: 
    - { pkg: git }
    - { pkg: project-builder }

- name: Install mageia-docker conf file
  copy: src=/users/bruno/prj/musique-ancienne.org/mondorescue.org/.mageia-docker dest=/home/bruno/.mageia-docker owner=bruno group=bruno mode=0644 backup=yes

- name: Install mageia-docker script file
  copy: src=files/mageia-docker.sh dest=/home/bruno/mageia-docker.sh owner=bruno group=bruno mode=0755 backup=yes

- name: Install ftp cleanup script
  copy: src=files/clean-ftp dest=/usr/local/bin/clean-ftp owner=root group=root mode=0755 backup=yes

- name: Set up mageia-docker crontab
  cron: name=mageia-docker minute=43 hour=23 job='/home/bruno/mageia-docker.sh {{ urpmi_server }}' user=bruno state=present backup=yes

- name: Set up docker image cleanup crontab
  cron: name=docker-img-cleanup minute=43 hour=07 job='docker image prune -f' user=bruno state=present backup=yes

- name: Set up docker container cleanup crontab
  cron: name=docker-ctn-cleanup minute=43 hour=06 job='docker container prune -f' user=bruno state=present backup=yes

- name: Set up ftp cleanup crontab
  cron: name=ftp-cleanup minute=43 hour=22 job='/usr/local/bin/clean-ftp' user=bruno state=present backup=yes
