---
- name: Ensure needed packages for ansible are installed
  action: apt pkg={{item}} state=present
  with_items:
    - python-pip
    - python-dev
    - build-essential
    - git

- name: Create a virtualenv and install ansible in it
  action: pip name=ansible virtualenv=/srv/ansible/venv state=present

# - name: Configure inventory file
#   action: template src=common/templates/inventory_file.j2 dest=/srv/ansible/playbooks/hosts

- name: Copy ansible configuration file for user root
  action: copy src=common/files/_ansible.cfg dest=/root/.ansible.cfg

- name: download ansible playbook
  action: git repo=git://github.com/gc3-uzh-ch/ansible-playbooks.git dest=/srv/ansible/playbooks

- name: setup cron
  action: template src=common/templates/ansible.cron.j2 dest=/etc/cron.hourly/ansible mode=0755 owner=root group=root