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
7be8d134
Commit
7be8d134
authored
Feb 23, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename 'successful' to 'contacted' ...
parent
530e54b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
README.md
+7
-3
lib/ansible/__init__.py
+2
-2
No files found.
README.md
View file @
7be8d134
...
...
@@ -75,7 +75,10 @@ Run a module by name with arguments
API Example
===========
The API is simple and returns basic datastructures.
The API is simple and returns basic datastructures. Ansible will keep
track of which hosts were successfully contacted seperately from hosts
that had communication problems. The format of the return, if successful,
is entirely up to the module.
import ansible
runner = ansible.Runner(
...
...
@@ -86,17 +89,18 @@ The API is simple and returns basic datastructures.
data = runner.run()
{
'
successful
' : {
'
contacted
' : {
'xyz.example.com' : [ 'any kind of datastructure is returnable' ],
'foo.example.com' : [ '...' ]
},
'
failed
' : {
'
dark
' : {
'bar.example.com' : [ 'failure message' ]
}
}
Additional options to Runner include the number of forks, hostname
exclusion pattern, library path, arguments, and so on.
Read the source, it's not complicated.
Patterns
...
...
lib/ansible/__init__.py
View file @
7be8d134
...
...
@@ -155,8 +155,8 @@ class Runner(object):
hosts
=
[
(
self
,
x
)
for
x
in
hosts
]
results
=
pool
.
map
(
_executor_hook
,
hosts
)
results2
=
{
"
successful
"
:
{},
"
failed"
:
{}
"
contacted
"
:
{},
"
dark"
:
{}
}
for
x
in
results
:
(
host
,
is_ok
,
result
)
=
x
...
...
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