Ansible Notes

This will encompass things that I find useful and end up looking up later when I haven't coded in a while.


- name: Go to the folder and execute command
  command: chdir=/opt/tools/temp ls


Add apt repo

This will create ```docker.list``` in ```/etc/apt/sources.list.d/``` and update the apt repo to reflect this change.

- name: Configure docker apt repo
    repo: 'deb stretch stable'
    state: present
    filename: 'docker'
    update_cache: 'yes'
  become: true


Best practices coding guide

Properly formatting a requirements.yml file

Run playbook locally

ansible-playbook site.yml -l localhost -vvvv --user=<user> --ask-pass

Multi line string

This creates a variable called custom_vim_plugins and assigns it a multi-line string after the |

custom_vim_plugins : |
      name = 'hashivim/vim-terraform'
      merged = 0