mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
Update shell terminal example to reflect need to single quote shell variables.
This commit is contained in:
parent
5327f52c3c
commit
5a9fe3ac62
17 changed files with 22 additions and 20 deletions
|
@ -185,10 +185,11 @@ here. We’ll use <cite>-m</cite> later to run some other <a class="referen
|
|||
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>
|
||||
<div class="highlight-python"><pre>ansible raleigh -m shell -a "echo \\$TERM"</pre>
|
||||
<div class="highlight-python"><pre>ansible raleigh -m shell -a 'echo $TERM'</pre>
|
||||
</div>
|
||||
<p>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.</p>
|
||||
to shell quoting rules, so the shell doesn’t eat a variable before it gets passed to Ansible. For example, u
|
||||
using double vs single quotes would evaluate the variable on the box you were on.</p>
|
||||
<p>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.
|
||||
|
@ -328,7 +329,7 @@ a simplified syntax for this.</p>
|
|||
<p class="pull-right"><a href="#">Back to top</a></p>
|
||||
<p>
|
||||
© Copyright 2012 Michael DeHaan.<br/>
|
||||
Last updated on Mar 22, 2012.<br/>
|
||||
Last updated on Mar 23, 2012.<br/>
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.8.<br/>
|
||||
</p>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue