Ansible recipes

- name: ensure .ssh/config  exists
    copy:
        content: ""
        dest: ~/.ssh/config
    sudo: yes
    sudo_user: vagrant

- name: ensure .ssh/config has correct permissions
    file: path=~/.ssh/config state=touch mode=0700
    sudo: yes
    sudo_user: vagrant

- name: check .ssh/config has bitbucketid
    lineinfile: dest=~/.ssh/config regexp='^IdentityFile ~/.ssh/bitbucketid' line='IdentityFile ~/.ssh/bitbucketid'
    sudo: yes
    sudo_user: vagrant

Create symbolic link

  file: src=/dir1/file.php dest=/dir2/file.php state=link

Copy files

  command: cp /dir1/file.php /dir2/file.php

Create a file (once)

- name: Create file
    command: touch /tmp/martin
    args:
    creates: /tmp/martin

Checking config - list hosts in playbook

ansible-playbook example.yml --list-hosts