Changes

Jump to: navigation, search

ReleaseEngineering/How To/Use Ansible for AdHoc Updates

1,797 bytes added, 23:15, 15 January 2015
Created page with "{{Release Engineering How To|AUse Ansible for Ad-Hoc Updates}} ==Ansible== Ansible is an orchestration/configuration management system written in Python. Since we already ha..."
{{Release Engineering How To|AUse Ansible for Ad-Hoc Updates}}

==Ansible==

Ansible is an orchestration/configuration management system written in Python. Since we already have Puppet in place for configuration management, RelEng will only care about ways that Ansible's orchestration oriented features. The cases where one may want to use Ansible are:

====You may want to use ansible for:====
* Quickly running a command against all running hosts
* Testing changes against a subset of all running hosts
* Gathering data on an ad hoc basis (grepping logs for instance)

====Reasons to use Ansible:====
* It has lots of nice builtin modules (see the [[http://docs.ansible.com/ docs]])
* You can define orchestration tasks in a repeatable, clean way, by simply writing them as a playbook (YAML)
* It gives our operational scripts (for killing machines, applying common fixes, etc...) a common framework, allowing users (other than the original author) to understand them more easily

==How To:==

==Set it up locally:==

1.) Make sure you have AWS creds, and the AWS_SECRET_KEY and AWS_ACCESS_KEY_ID environment variables set
2.) <code>pip install ansible</code>
3.) <code>git clone https://github.com/catlee/build-ansible/</code>

-optional but highly recommended-

4.) set the environment variable <code>ANSIBLE_HOST_KEY_CHECKING=False</code> to prevent prompts for adding boxes to known hosts
5.) use ssh-agent to prevent needing to type your passcode thousands of times >.<

==Run an ad-hoc command:==

Add a file "/tmp/foo" to every tst-linux64 host: <code>ansible -u root -i ec2-inventory.py -a "touch /tmp/foo" tst-linux64</code>
Rm the file: <code>ansible -u root -i ec2-inventory.py -a "rm /tmp/foo" tst-linux64</code>

Similarly, replace tst-linux64 with tst-linux32, try-linux32, etc...
78
edits

Navigation menu