From 337de79cf41fed6334d68eab31b0a64bfa4e8e4f Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Fri, 30 Mar 2012 22:10:32 -0400 Subject: [PATCH] Add sudo/port info to examples, and sudo info to playbooks. --- rst/examples.rst | 14 +++++++++++++- rst/playbooks.rst | 8 +++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/rst/examples.rst b/rst/examples.rst index ab2831a46ae..7f165f34c13 100644 --- a/rst/examples.rst +++ b/rst/examples.rst @@ -21,7 +21,19 @@ Now to run the command on all servers in a group, in this case, 'atlanta':: ansible atlanta -a "/sbin/reboot" -f 10 -If you didn't read about patterns and groups yet, go back and read :doc:`patterns`. +If you want to run commands as a different user than root:: + + ansible atlanta -a "/usr/bin/foo" -u yourname + +If you want to run commands through sudo:: + + ansible atlanta -a "/usr/bin/foo" -u yourname --sudo + +If you need to access SSH on a different port:: + + ansible atlanta -a "/usr/bin/foo" -p 2112 + +Ok, so those are basics. If you didn't read about patterns and groups yet, go back and read :doc:`patterns`. 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 diff --git a/rst/playbooks.rst b/rst/playbooks.rst index 5e394d9eecb..901092a98cd 100644 --- a/rst/playbooks.rst +++ b/rst/playbooks.rst @@ -73,7 +73,13 @@ documentation. The `user` is just the name of the user account:: user: root -Support for running things from sudo is pending. +Support for running things from sudo is also available. Sudo must be +configured to not require a password. + + --- + - hosts: webservers + user: yourname + sudo: True Vars section