You can use ansible command line (ad-hoc) to make small changes however the real power lies in it's scripting capabilities using playbooks.
Ansible playbooks are use in Puppet and Chef.
Puppet → Module
Chef → Cookbook
Playbooks are divided into 3 sections:
- Targets Section - defines on which host(s) this playbook will be executed and how it will be executed.
This will be done over ssh - Variable Section (Optional) - defines your variables which can be used by the playbook.
- Task Section - List all the modules you intend to run.
Here is a sample playbook.
Note: proper indentation is very important.
playbook - test.yml
|
This sample playbook will create a file on the defined host with the warning message defined.
To run this playbook simple issue the command: ansible-playbook <file.yml>
commandline
|
TODO
If you desire to run this script on a host besides localhost, you will need to ....
Modules
For a full list of modules that can be used with ansible, see http://docs.ansible.com/ansible/list_of_all_modules.html.