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
2063e10c
Commit
2063e10c
authored
Oct 12, 2012
by
Aurélien Bondis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
named actions + modules list in utils.py
parent
dfaef806
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
10 deletions
+16
-10
lib/ansible/playbook/__init__.py
+1
-0
lib/ansible/playbook/task.py
+1
-10
lib/ansible/utils.py
+14
-0
No files found.
lib/ansible/playbook/__init__.py
View file @
2063e10c
...
@@ -107,6 +107,7 @@ class PlayBook(object):
...
@@ -107,6 +107,7 @@ class PlayBook(object):
self
.
inventory
=
ansible
.
inventory
.
Inventory
(
host_list
)
self
.
inventory
=
ansible
.
inventory
.
Inventory
(
host_list
)
self
.
inventory
.
subset
(
subset
)
self
.
inventory
.
subset
(
subset
)
self
.
modules_list
=
utils
.
get_available_modules
(
self
.
module_path
)
if
not
self
.
inventory
.
_is_script
:
if
not
self
.
inventory
.
_is_script
:
self
.
global_vars
.
update
(
self
.
inventory
.
get_group_variables
(
'all'
))
self
.
global_vars
.
update
(
self
.
inventory
.
get_group_variables
(
'all'
))
...
...
lib/ansible/playbook/task.py
View file @
2063e10c
...
@@ -17,9 +17,6 @@
...
@@ -17,9 +17,6 @@
from
ansible
import
errors
from
ansible
import
errors
from
ansible
import
utils
from
ansible
import
utils
import
ansible.constants
as
C
import
os
from
os
import
pathsep
class
Task
(
object
):
class
Task
(
object
):
...
@@ -43,14 +40,8 @@ class Task(object):
...
@@ -43,14 +40,8 @@ class Task(object):
''' constructor loads from a task or handler datastructure '''
''' constructor loads from a task or handler datastructure '''
# code to allow for saying "modulename: args" versus "action: modulename args"
# code to allow for saying "modulename: args" versus "action: modulename args"
modules_list
=
set
()
for
path
in
C
.
DEFAULT_MODULE_PATH
.
split
(
pathsep
):
if
os
.
path
.
exists
(
path
):
modules_list
.
update
(
os
.
listdir
(
path
))
modules_list
=
list
(
modules_list
)
for
x
in
ds
.
keys
():
for
x
in
ds
.
keys
():
if
x
in
modules_list
:
if
x
in
play
.
playbook
.
modules_list
:
ds
[
'action'
]
=
x
+
" "
+
ds
.
get
(
x
,
None
)
ds
[
'action'
]
=
x
+
" "
+
ds
.
get
(
x
,
None
)
ds
.
pop
(
x
)
ds
.
pop
(
x
)
elif
not
x
in
Task
.
VALID_KEYS
:
elif
not
x
in
Task
.
VALID_KEYS
:
...
...
lib/ansible/utils.py
View file @
2063e10c
...
@@ -675,3 +675,17 @@ def import_plugins(directory):
...
@@ -675,3 +675,17 @@ def import_plugins(directory):
if
not
name
.
startswith
(
"_"
):
if
not
name
.
startswith
(
"_"
):
modules
[
name
]
=
imp
.
load_source
(
name
,
path
)
modules
[
name
]
=
imp
.
load_source
(
name
,
path
)
return
modules
return
modules
def
get_available_modules
(
dirname
=
None
):
"""
returns a list of modules available based on current directory
looks in DEFAULT_MODULE_PATH, all subfolders named library and
-M option"""
modules_list
=
set
()
if
dirname
is
None
:
dirname
=
C
.
DEFAULT_MODULE_PATH
for
path
in
dirname
.
split
(
os
.
pathsep
):
if
os
.
path
.
exists
(
path
):
modules_list
.
update
(
os
.
listdir
(
path
))
modules_list
=
list
(
modules_list
)
return
modules_list
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