|
| 1 | +# Ansible Patterns |
| 2 | + |
| 3 | +This is a collection of useful patterns for [ansible](http://ansible.cc/), a server management and orchestration tool. |
| 4 | + |
| 5 | +You can use ansible to do things such as installing packages, restarting services, uploading files and enabling apache sites. |
| 6 | + |
| 7 | +## Getting started |
| 8 | + |
| 9 | +First, [install ansible](http://ansible.cc/docs/gettingstarted.html) and create your |
| 10 | +ansible hosts (inventory) file with the details of the servers you're going to manage with ansible. |
| 11 | + |
| 12 | +For convenience, here is the format of the hosts file: |
| 13 | + |
| 14 | + SERVERNAME ansible_ssh_user=USERNAME ansible_ssh_host=IPADDRESS ansible_connection=ssh |
| 15 | + |
| 16 | +where |
| 17 | + |
| 18 | +- `SERVERNAME` is the nickname of the server, |
| 19 | +- `USERNAME` is the SSH username, and |
| 20 | +- `IPADDRESS` is the IP address of the machine. |
| 21 | + |
| 22 | +For example, your hosts file might look like this: |
| 23 | + |
| 24 | + web1 ansible_ssh_user=daviddoran ansible_ssh_host=192.0.2.1 ansible_connection=ssh |
| 25 | + |
| 26 | +## Using a pattern |
| 27 | + |
| 28 | +`cd` into the directory of the pattern: |
| 29 | + |
| 30 | + cd developer-keys |
| 31 | + |
| 32 | +Configure the example-playbook file (follow the instructions in the folder's README file). |
| 33 | + |
| 34 | +Run the example playbook on your hosts file: |
| 35 | + |
| 36 | + ansible-playbook -i hosts example-playbook.yml |
| 37 | + |
| 38 | +where `hosts` is the path to your hosts file. |
| 39 | + |
| 40 | +## Requirements |
| 41 | + |
| 42 | +- ansible on your development computer |
| 43 | +- the ansible prerequisites on your servers (usually just Python 2.6) |
| 44 | +- a [hosts file](http://ansible.cc/docs/patterns.html) (containing the hostnames of your server) |
| 45 | + |
| 46 | +## License |
| 47 | + |
| 48 | +This project is released under the MIT License - see the LICENSE file for details. |
0 commit comments