diff --git a/examples.html b/examples.html index 9f82248c92..58daeb1e02 100644 --- a/examples.html +++ b/examples.html @@ -163,41 +163,40 @@ s.parentNode.insertBefore(ga, s);
The following examples show how to use /usr/bin/ansible for running ad-hoc tasks. -Start here. For configuration management and deployments, you’ll want to pick up on -using /usr/bin/ansible-playbook – the concepts port over directly.
+Start here. +For configuration management and deployments, you’ll want to pick up on +using /usr/bin/ansible-playbook – the concepts port over directly. +(See Playbooks for more information about those)
Let’s use ansible’s command line tool to reboot all web servers in Atlanta, 10 at a time:
+Let’s use ansible’s command line tool to reboot all web servers in Atlanta, 10 at a time. First, let’s +set up SSH-agent so it can remember our credentials:
ssh-agent bash
-ssh-add ~/.ssh/id_rsa.pub
-
-ansible atlanta -a "/sbin/reboot" -f 10
+ssh-add ~/.ssh/id_rsa.pub
The -f 10 specifies the usage of 10 simultaneous processes.
-Note
--m does not always have to be specified to /usr/bin/ansible because ‘command’ is the default ansible module
+Now to run the command on all servers in a group, in this case, ‘atlanta’:
+ansible atlanta -a "/sbin/reboot" -f 10
If we want to execute a module using the shell, we can avoid using absolute paths, and can also include -pipe and redirection operators. Read more about the differences on the Ansible Modules page. The shell +
If you didn’t read about patterns and groups yet, go back and read The Inventory File, Patterns, and Groups.
+The -f 10 in the above specifies the usage of 10 simultaneous processes. Normally commands also take +a -m for module name, but the default module name is ‘command’, so we didn’t need to specify that +here. We’ll use -m later to run some other Ansible Modules.
+The command module requires absolute paths and does not support shell variables. If we want to +execute a module using the shell, we can do those things, and also use pipe and redirection operators. +Read more about the differences on the Ansible Modules page. The shell module looks like this:
ansible raleigh -m shell -a "echo \\$TERM"
Note
-When using ansible to run commands, and in particular the shell module, be careful of shell quoting rules.
-Note
-Note that other than the command Ansible Modules, ansible modules usually do -not work like simple scripts. They make the remote system look like -you state, and run the commands necessary to get it there. This -is commonly referred to as ‘idempotence’, and is a core design goal of ansible. However, we also -recognize that running ad-hoc commands is equally imporant, so Ansible easily supports both.
-When running any command with the ansible “ad hoc” CLI (as opposed to playbooks), pay particular attention +to shell quoting rules, so the shell doesn’t eat a variable before it gets passed to Ansible.
+So far we’ve been demoing simple command execution, but most ansible modules usually do not work like +simple scripts. They make the remote system look like you state, and run the commands necessary to +get it there. This is commonly referred to as ‘idempotence’, and is a core design goal of ansible. +However, we also recognize that running ad-hoc commands is equally imporant, so Ansible easily supports both.
Here’s another use case for the /usr/bin/ansible command line.
Ansible can SCP lots of files to multiple machines in parallel, and optionally use them as template sources.
To just transfer a file directly to many different servers:
@@ -248,7 +247,7 @@ ansible webservers -m file -a "dest=/srv/foo/b.txt mode=600 owner=mdehaan group=ansible-webservers -m yum -a "pkg=acme state=removed"
Currently Ansible only has a module for managing packages with yum. You can install -for other package manages using the command module or contribute a module +for other packages for now using the command module or (better!) contribute a module for other package managers. Stop by the mailing list for info/details.
Deploy your webapp straight from git:
-ansible webservers -m git -a "repo=git://foo dest=/srv/myapp version=HEAD"
+ansible webservers -m git -a "repo=git://foo.example.org/repo.git dest=/srv/myapp version=HEAD"
Since ansible modules can notify change handlers (see Playbooks) it is possible to tell ansible to run specific tasks diff --git a/man/ansible-playbook.1.html b/man/ansible-playbook.1.html index bd5828ad20..2afa505dd4 100644 --- a/man/ansible-playbook.1.html +++ b/man/ansible-playbook.1.html @@ -1,6 +1,6 @@ -
ansible-playbook — run an ansible playbook
Ansible playbooks are a configuration and multinode deployment system. Ansible-playbook is the tool +
ansible-playbook — run an ansible playbook
Ansible playbooks are a configuration and multinode deployment system. Ansible-playbook is the tool used to run them. See the project home page (link below) for more information.
ansible — run a command somewhere else
Ansible is an extra-simple tool/framework/API for doing 'remote things' over +
ansible — run a command somewhere else