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
41211096
Commit
41211096
authored
Aug 19, 2012
by
Tim Bielawa
Committed by
Michael DeHaan
Aug 20, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Local actions, they're like aliases for actions with localhost
delegates. Closes #905
parent
8b06c07b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
lib/ansible/playbook/task.py
+21
-7
No files found.
lib/ansible/playbook/task.py
View file @
41211096
...
@@ -18,20 +18,22 @@
...
@@ -18,20 +18,22 @@
from
ansible
import
errors
from
ansible
import
errors
from
ansible
import
utils
from
ansible
import
utils
class
Task
(
object
):
class
Task
(
object
):
__slots__
=
[
__slots__
=
[
'name'
,
'action'
,
'only_if'
,
'async_seconds'
,
'async_poll_interval'
,
'name'
,
'action'
,
'only_if'
,
'async_seconds'
,
'async_poll_interval'
,
'notify'
,
'module_name'
,
'module_args'
,
'module_vars'
,
'notify'
,
'module_name'
,
'module_args'
,
'module_vars'
,
'play'
,
'notified_by'
,
'tags'
,
'register'
,
'with_items'
,
'play'
,
'notified_by'
,
'tags'
,
'register'
,
'with_items'
,
'delegate_to'
,
'first_available_file'
,
'ignore_errors'
'delegate_to'
,
'first_available_file'
,
'ignore_errors'
,
'local_action'
]
]
# to prevent typos and such
# to prevent typos and such
VALID_KEYS
=
[
VALID_KEYS
=
[
'name'
,
'action'
,
'only_if'
,
'async'
,
'poll'
,
'notify'
,
'with_items'
,
'name'
,
'action'
,
'only_if'
,
'async'
,
'poll'
,
'notify'
,
'with_items'
,
'first_available_file'
,
'include'
,
'tags'
,
'register'
,
'ignore_errors'
,
'first_available_file'
,
'include'
,
'tags'
,
'register'
,
'ignore_errors'
,
'delegate_to'
'delegate_to'
,
'local_action'
]
]
def
__init__
(
self
,
play
,
ds
,
module_vars
=
None
):
def
__init__
(
self
,
play
,
ds
,
module_vars
=
None
):
...
@@ -45,10 +47,23 @@ class Task(object):
...
@@ -45,10 +47,23 @@ class Task(object):
self
.
play
=
play
self
.
play
=
play
# load various attributes
# load various attributes
self
.
name
=
ds
.
get
(
'name'
,
None
)
self
.
name
=
ds
.
get
(
'name'
,
None
)
self
.
action
=
ds
.
get
(
'action'
,
''
)
self
.
tags
=
[
'all'
]
self
.
tags
=
[
'all'
]
self
.
register
=
ds
.
get
(
'register'
,
None
)
self
.
register
=
ds
.
get
(
'register'
,
None
)
# Both are defined
if
(
'action'
in
ds
)
and
(
'local_action'
in
ds
):
raise
errors
.
AnsibleError
(
"the 'action' and 'local_action' attributes can not be used together"
)
# Both are NOT defined
elif
(
not
'action'
in
ds
)
and
(
not
'local_action'
in
ds
):
raise
errors
.
AnsibleError
(
"task missing an 'action' attribute"
)
# Only one of them is defined
elif
'local_action'
in
ds
:
self
.
action
=
ds
.
get
(
'local_action'
,
''
)
self
.
delegate_to
=
'127.0.0.1'
else
:
self
.
action
=
ds
.
get
(
'action'
,
''
)
self
.
delegate_to
=
ds
.
get
(
'delegate_to'
,
None
)
# notified by is used by Playbook code to flag which hosts
# notified by is used by Playbook code to flag which hosts
# need to run a notifier
# need to run a notifier
...
@@ -65,7 +80,6 @@ class Task(object):
...
@@ -65,7 +80,6 @@ class Task(object):
self
.
notify
=
ds
.
get
(
'notify'
,
[])
self
.
notify
=
ds
.
get
(
'notify'
,
[])
self
.
first_available_file
=
ds
.
get
(
'first_available_file'
,
None
)
self
.
first_available_file
=
ds
.
get
(
'first_available_file'
,
None
)
self
.
with_items
=
ds
.
get
(
'with_items'
,
None
)
self
.
with_items
=
ds
.
get
(
'with_items'
,
None
)
self
.
delegate_to
=
ds
.
get
(
'delegate_to'
,
None
)
self
.
ignore_errors
=
ds
.
get
(
'ignore_errors'
,
False
)
self
.
ignore_errors
=
ds
.
get
(
'ignore_errors'
,
False
)
...
...
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