2 title: "Ansible quickstart"
6 A quick guide to getting started with your first Ansible playbook.
12 $ brew install ansible # OSX
13 $ [sudo] apt install ansible # elsewhere
16 Ansible is available as a package in most OS's.
18 See: [Installation](http://docs.ansible.com/ansible/latest/intro_installation.html)
20 ### Start your project
27 Make a folder for your Ansible files.
29 See: [Getting started](http://docs.ansible.com/ansible/latest/intro_getting_started.html)
31 ## Creating your files
45 This is a list of hosts you want to manage, grouped into groups. (Hint: try
46 using `localhost ansible_connection=local` to deploy to your local machine.)
48 See: [Intro to Inventory](http://docs.ansible.com/ansible/latest/intro_inventory.html)
52 #### ~/setup/playbook.yml
59 apt: pkg=nginx state=present
61 - name: start nginx every bootup
62 service: name=nginx state=started enabled=yes
64 - name: do something in the shell
65 shell: echo hello > /tmp/abc.txt
67 - name: install bundler
68 gem: name=bundler state=latest
71 See: [Intro to Playbooks](http://docs.ansible.com/ansible/latest/playbooks_intro.html)
75 ### Running ansible-playbook
83 #### Running the playbook
86 ~/setup$ ansible-playbook -i hosts playbook.yml
87 PLAY [all] ********************************************************************
89 GATHERING FACTS ***************************************************************
92 TASK: [install nginx] *********************************************************
95 TASK: start nginx every bootup] ***********************************************
102 * [Getting started with Ansible](http://lowendbox.com/blog/getting-started-with-ansible/) _(lowendbox.com)_
103 * [Getting started](http://docs.ansible.com/ansible/latest/intro_getting_started.html) _(docs.ansible.com)_
104 * [Intro to Inventory](http://docs.ansible.com/ansible/latest/intro_inventory.html) _(docs.ansible.com)_
105 * [Intro to Playbooks](http://docs.ansible.com/ansible/latest/playbooks_intro.html) _(docs.ansible.com)_