Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
1c5f5aca
Commit
1c5f5aca
authored
May 02, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rebuild
parent
0c2dd7b0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
playbooks.html
+10
-9
searchindex.js
+0
-0
No files found.
playbooks.html
View file @
1c5f5aca
...
...
@@ -533,11 +533,7 @@ include files to do this.</p>
<div
class=
"highlight-python"
><pre>
- tasks:
- include: tasks/foo.yml
</pre>
</div>
<p>
Variables passed in can be used in the include files too. Assume a variable named
‘
user
’
. Using
<cite>
jinja2
</cite>
syntax, anywhere in the included file, you can say:
</p>
<div
class=
"highlight-python"
><pre>
{{ user }}
</pre>
</div>
<p>
I can also pass variables into includes directly. We might call this a
‘
parameterized include
’
.
</p>
<p>
You can also pass variables into includes directly. We might call this a
‘
parameterized include
’
.
</p>
<p>
For instance, if deploying multiple wordpress instances, I could
contain all of my wordpress tasks in a single wordpress.yml file, and use it like so:
</p>
<div
class=
"highlight-python"
><pre>
- tasks:
...
...
@@ -545,15 +541,20 @@ contain all of my wordpress tasks in a single wordpress.yml file, and use it lik
- include: wordpress.yml user=alice
- include: wordpress.yml user=bob
</pre>
</div>
<p>
Variables passed in can be used in the included files. Using
<cite>
jinja2
</cite>
syntax, in the included file, you can reference them like this:
</p>
<div
class=
"highlight-python"
><pre>
{{ user }}
</pre>
</div>
<p>
or, more simply, using Ansible
’
s simplified variable syntax:
</p>
<div
class=
"highlight-python"
><pre>
$user
</pre>
</div>
<p>
In addition to the explicitly passed in parameters, all variables from
the vars section are also available for use here as well. Variables that bubble
up from tools like facter and ohai are not usable here though
–
but they ARE available for use
inside
‘
action
’
lines and in templates.
</p>
the vars section are also available for use here as well.
</p>
<div
class=
"admonition note"
>
<p
class=
"first admonition-title"
>
Note
</p>
<p
class=
"last"
>
Include statements are only usable from the top level
playbook file. This means includes can not include other
includes.
</p>
includes.
This may be implemented in a later release.
</p>
</div>
<p>
Includes can also be used in the
‘
handlers
’
section, for instance, if you
want to define how to restart apache, you only have to do that once for all
...
...
searchindex.js
View file @
1c5f5aca
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment