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
a19a0ca9
Commit
a19a0ca9
authored
Mar 01, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update documentation on complex args to new simpler format.
parent
fb26f059
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
+18
-12
docsite/rst/playbooks2.rst
+18
-12
No files found.
docsite/rst/playbooks2.rst
View file @
a19a0ca9
...
@@ -945,8 +945,8 @@ feature produces a large amount of output, it is best used when checking a singl
...
@@ -945,8 +945,8 @@ feature produces a large amount of output, it is best used when checking a singl
ansible-playbook foo.yml --check --diff --limit foo.example.com
ansible-playbook foo.yml --check --diff --limit foo.example.com
Passing Complex Arguments From Dictionarie
s
Dictionary & Nested (Complex) Argument
s
```````````````````````````````````````
````
```````````````````````````````````````
As a review, most tasks in ansbile are of this form::
As a review, most tasks in ansbile are of this form::
...
@@ -956,14 +956,12 @@ As a review, most tasks in ansbile are of this form::
...
@@ -956,14 +956,12 @@ As a review, most tasks in ansbile are of this form::
yum: name=cobbler state=installed
yum: name=cobbler state=installed
However, in some cases, it may be useful to feed arguments directly in from a hash (dictionary). In fact, a very small
However, in some cases, it may be useful to feed arguments directly in from a hash (dictionary). In fact, a very small
number of modules (the CloudFormations module is one) actually require complex arguments that can't be fit
number of modules (the CloudFormations module is one) actually require complex arguments. They work like this::
into a key=value system. To pass arguments in from a hash (dictionary), do this::
tasks:
tasks:
- name: call a module that requires some complex arguments
- name: call a module that requires some complex arguments
module_name_goes_here: asdf=1234
foo_module:
args:
fibonacci_list:
fibonacci_list:
- 1
- 1
- 1
- 1
...
@@ -976,14 +974,22 @@ into a key=value system. To pass arguments in from a hash (dictionary), do this
...
@@ -976,14 +974,22 @@ into a key=value system. To pass arguments in from a hash (dictionary), do this
fish:
fish:
- limpet
- limpet
- nemo
- nemo
- ${other_fish_name}
You can of course use variables inside these, as noted above.
If using local_action, you can do this::
- name: call a module that requires some complex arguments
local_action:
module: foo_module
arg1: 1234
arg2: 'asdf'
While complex arguments can be fed to most modules in Ansible, they should only be used where needed. Note
Which of course means, though more verbose, this is also technically legal syntax::
that variable interpolation works exactly as you would suspect, so you can use "${foo}" and so on in values
inside of the dictionary you pass to "args".
If both key=value arguments are given along with 'args', the key=value arguments take priority. This technically
- name: foo
means you can set defaults by using 'args' if you so choose, though that is not the intended purpose of this
template: { src: '/templates/motd.j2', dest: '/etc/motd' }
feature.
Style Points
Style Points
````````````
````````````
...
...
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