- set_fact:
    checkout_dir: "/usr/local/src/ansible"

- name: Install dependencies of ansible
  package:
    name: "{{ item }}"
    state: present
  with_items:
  - python-jinja2
  - python-paramiko
  - python-httplib2
  - PyYAML
  - python-keyczar
  - python-netaddr

- name: Checkout git in {{ checkout_dir }}
  git:
    repo: "https://github.com/ansible/ansible.git"
    dest: "{{ checkout_dir }}"
    version: "{{ ansible_git_version }}"

- name: Create helper scripts
  template:
    dest: "/usr/local/bin/{{ item }}"
    src: "{{ item }}"
    mode: 0755
  with_items:
  - ansible_git
  - ansible_git_update

- name: Create compatibility links
  file:
    dest: "/usr/bin/{{ item }}"
    src: /usr/local/bin/ansible_git
    state: link
  with_items:
  - ansible
  - ansible-doc
  - ansible-galaxy
  - ansible-playbook
  - ansible-pull
  - ansible-vault

- name: Create /etc/ansible directory
  file:
    dest: /etc/ansible
    state: directory

- name: Set cron to automatically update the checkout
  cron:
    name: "update ansible git"
    minute: "*/20"
    job: /usr/local/bin/ansible_git_update

- set_fact:
    checkout_dir: "/usr/local/src/ansible"

- name: Install dependencies of ansible
  package:
    name: "{{ item }}"
    state: present
  with_items:
  - python-jinja2
  - python-paramiko
  - python-httplib2
  - PyYAML
  - python-keyczar
  - python-netaddr

- name: Checkout git in {{ checkout_dir }}
  git:
    repo: "https://github.com/ansible/ansible.git"
    dest: "{{ checkout_dir }}"
    version: "{{ ansible_git_version }}"

- name: Create helper scripts
  template:
    dest: "/usr/local/bin/{{ item }}"
    src: "{{ item }}"
    mode: 0755
  with_items:
  - ansible_git
  - ansible_git_update

- name: Create compatibility links
  file:
    dest: "/usr/bin/{{ item }}"
    src: /usr/local/bin/ansible_git
    state: link
  with_items:
  - ansible
  - ansible-doc
  - ansible-galaxy
  - ansible-playbook
  - ansible-pull
  - ansible-vault

- name: Create link for library
  file:
    dest: /usr/local/lib/ansible
    src:  /usr/local/src/ansible/lib/ansible
    state: link

- name: Create /etc/ansible directory
  file:
    dest: /etc/ansible
    state: directory

- name: Set cron to automatically update the checkout
  cron:
    name: "update ansible git"
    minute: "*/20"
    job: /usr/local/bin/ansible_git_update

Add a link to to git checkout library
Add a link to to git checkout library

Since we use ansible module, they have to be in a place
where they can be found to be used when we use the git checkout
method.
