Skip to content

Instantly share code, notes, and snippets.

@aaronmehar
Last active July 24, 2016 01:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronmehar/2308c1d3878be7fffa753697a33d61f4 to your computer and use it in GitHub Desktop.
Save aaronmehar/2308c1d3878be7fffa753697a33d61f4 to your computer and use it in GitHub Desktop.
Build a host file
http://docs.ansible.com/ansible/intro_inventory.html
Create a play:
----------------------------------------------
- name: Transfer and execute a script. <--- name of the play
hosts: all <--- which servesr to run this one, in this case, all of them
tasks: <--- start to define the jobs to do
- name: Copy and Execute the script <--- Name the first task
script: /home/user/userScript.sh <--- http://docs.ansible.com/ansible/script_module.html
----------------------------------------------
and run it;
ansible-playbook -i hosts site.yml <-- Run the play 'site.yml' and use the file called hosts which lists the servers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment