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
6d183959
Commit
6d183959
authored
Oct 12, 2012
by
Aurélien Bondis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#1303: add sudo option to tasks
parent
dfaef806
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
lib/ansible/playbook/__init__.py
+2
-2
lib/ansible/playbook/task.py
+10
-2
No files found.
lib/ansible/playbook/__init__.py
View file @
6d183959
...
@@ -223,8 +223,8 @@ class PlayBook(object):
...
@@ -223,8 +223,8 @@ class PlayBook(object):
private_key_file
=
self
.
private_key_file
,
private_key_file
=
self
.
private_key_file
,
setup_cache
=
self
.
SETUP_CACHE
,
basedir
=
task
.
play
.
basedir
,
setup_cache
=
self
.
SETUP_CACHE
,
basedir
=
task
.
play
.
basedir
,
conditional
=
task
.
only_if
,
callbacks
=
self
.
runner_callbacks
,
conditional
=
task
.
only_if
,
callbacks
=
self
.
runner_callbacks
,
sudo
=
task
.
play
.
sudo
,
sudo_user
=
task
.
play
.
sudo_user
,
sudo
=
task
.
sudo
,
sudo_user
=
task
.
sudo_user
,
transport
=
task
.
transport
,
sudo_pass
=
self
.
sudo_pass
,
is_playbook
=
True
transport
=
task
.
transport
,
sudo_pass
=
task
.
sudo_pass
,
is_playbook
=
True
)
)
if
task
.
async_seconds
==
0
:
if
task
.
async_seconds
==
0
:
...
...
lib/ansible/playbook/task.py
View file @
6d183959
...
@@ -29,14 +29,15 @@ class Task(object):
...
@@ -29,14 +29,15 @@ class Task(object):
'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'
,
'transport'
'local_action'
,
'transport'
,
'sudo'
,
'sudo_user'
,
'sudo_pass'
]
]
# 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'
,
'local_action'
,
'transport'
'delegate_to'
,
'local_action'
,
'transport'
,
'sudo'
,
'sudo_user'
,
'sudo_pass'
]
]
def
__init__
(
self
,
play
,
ds
,
module_vars
=
None
):
def
__init__
(
self
,
play
,
ds
,
module_vars
=
None
):
...
@@ -63,6 +64,13 @@ class Task(object):
...
@@ -63,6 +64,13 @@ class Task(object):
self
.
name
=
ds
.
get
(
'name'
,
None
)
self
.
name
=
ds
.
get
(
'name'
,
None
)
self
.
tags
=
[
'all'
]
self
.
tags
=
[
'all'
]
self
.
register
=
ds
.
get
(
'register'
,
None
)
self
.
register
=
ds
.
get
(
'register'
,
None
)
self
.
sudo
=
ds
.
get
(
'sudo'
,
play
.
sudo
)
if
self
.
sudo
is
True
:
self
.
sudo_user
=
ds
.
get
(
'sudo_user'
,
play
.
sudo_user
)
self
.
sudo_pass
=
ds
.
get
(
'sudo_pass'
,
play
.
playbook
.
sudo_pass
)
else
:
self
.
sudo_user
=
None
self
.
sudo_pass
=
None
# Both are defined
# Both are defined
if
(
'action'
in
ds
)
and
(
'local_action'
in
ds
):
if
(
'action'
in
ds
)
and
(
'local_action'
in
ds
):
...
...
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