mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-10 11:11:29 -07:00
fix rst + docs rebuild
This commit is contained in:
parent
f81000c127
commit
85cedf52ef
14 changed files with 143 additions and 67 deletions
|
@ -194,21 +194,28 @@ set up SSH-agent so it can remember our credentials:</p>
|
|||
<div class="highlight-python"><pre>ssh-agent bash
|
||||
ssh-add ~/.ssh/id_rsa.pub</pre>
|
||||
</div>
|
||||
<p>Now to run the command on all servers in a group, in this case, ‘atlanta’:</p>
|
||||
<p>If you don’t want to use ssh-agent and want to instead SSH with a password instead of keys, you can with
|
||||
–ask-pass (-k), but it’s much better to just use ssh-agent.</p>
|
||||
<p>Now to run the command on all servers in a group, in this case, ‘atlanta’, in 10 parallel forks:</p>
|
||||
<div class="highlight-python"><pre>ansible atlanta -a "/sbin/reboot" -f 10</pre>
|
||||
</div>
|
||||
<p>If you want to run commands as a different user than root:</p>
|
||||
<p>If you want to run commands as a different user than root, it looks like this:</p>
|
||||
<div class="highlight-python"><pre>ansible atlanta -a "/usr/bin/foo" -u yourname</pre>
|
||||
</div>
|
||||
<p>If you want to run commands through sudo:</p>
|
||||
<div class="highlight-python"><pre>ansible atlanta -a "/usr/bin/foo" -u yourname --sudo [--ask-sudo-pass]</pre>
|
||||
</div>
|
||||
<p>Use –ask-sudo-pass (-K) if you are not using passwordless sudo.</p>
|
||||
<p>Use –ask-sudo-pass (-K) if you are not using passwordless sudo. This will interactively prompt
|
||||
you for the password to use. Use of passwordless sudo makes things easier to automate, but it’s
|
||||
not required.</p>
|
||||
<p>It is also possible to sudo to a user other than root using –sudo-user (-U):</p>
|
||||
<div class="highlight-python"><pre>ansible atlanta -a "/usr/bin/foo" -u yourname -U otheruser [--ask-sudo-pass]</pre>
|
||||
</div>
|
||||
<p>Ok, so those are basics. If you didn’t read about patterns and groups yet, go back and read <a class="reference internal" href="patterns.html"><em>The Inventory File, Patterns, and Groups</em></a>.</p>
|
||||
<p>The -f 10 in the above specifies the usage of 10 simultaneous processes. Normally commands also take
|
||||
a <cite>-m</cite> for module name, but the default module name is ‘command’, so we didn’t need to specify that
|
||||
here. We’ll use <cite>-m</cite> later to run some other <a class="reference internal" href="modules.html"><em>Ansible Modules</em></a>.</p>
|
||||
<p>The command module requires absolute paths and does not support shell variables. If we want to
|
||||
all of the time. We’ll use <cite>-m</cite> in later examples to run some other <a class="reference internal" href="modules.html"><em>Ansible Modules</em></a>.</p>
|
||||
<p>Note that 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 <a class="reference internal" href="modules.html"><em>Ansible Modules</em></a> page. The shell
|
||||
module looks like this:</p>
|
||||
|
@ -373,7 +380,7 @@ a simplified syntax for this.</p>
|
|||
</p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on May 06, 2012.<br/>
|
||||
Last updated on May 10, 2012.<br/>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue