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
a58baae2
Commit
a58baae2
authored
May 23, 2013
by
node
Committed by
Michael DeHaan
May 31, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the actual user used for executing play available as 'ansible_ssh_user' variable
parent
957a7bf3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
lib/ansible/runner/__init__.py
+9
-3
No files found.
lib/ansible/runner/__init__.py
View file @
a58baae2
...
...
@@ -433,7 +433,6 @@ class Runner(object):
complex_args
=
utils
.
safe_eval
(
complex_args
)
if
type
(
complex_args
)
!=
dict
:
raise
errors
.
AnsibleError
(
"args must be a dictionary, received
%
s"
%
complex_args
)
result
=
self
.
_executor_internal_inner
(
host
,
self
.
module_name
,
...
...
@@ -478,9 +477,8 @@ class Runner(object):
new_args
=
new_args
+
"
%
s='
%
s' "
%
(
k
,
v
)
module_args
=
new_args
# module_name may be dynamic (but cannot contain {{ ansible_ssh_user }})
module_name
=
template
.
template
(
self
.
basedir
,
module_name
,
inject
)
module_args
=
template
.
template
(
self
.
basedir
,
module_args
,
inject
)
complex_args
=
template
.
template
(
self
.
basedir
,
complex_args
,
inject
)
if
module_name
in
utils
.
plugins
.
action_loader
:
if
self
.
background
!=
0
:
...
...
@@ -536,9 +534,13 @@ class Runner(object):
actual_host
=
delegate_to
actual_port
=
port
# user/pass may still contain variables at this stage
actual_user
=
template
.
template
(
self
.
basedir
,
actual_user
,
inject
)
actual_pass
=
template
.
template
(
self
.
basedir
,
actual_pass
,
inject
)
# make actual_user available as __magic__ ansible_ssh_user variable
inject
[
'ansible_ssh_user'
]
=
actual_user
try
:
if
actual_port
is
not
None
:
actual_port
=
int
(
actual_port
)
...
...
@@ -561,6 +563,10 @@ class Runner(object):
if
getattr
(
handler
,
'NEEDS_TMPPATH'
,
True
):
tmp
=
self
.
_make_tmp_path
(
conn
)
# render module_args and complex_args templates
module_args
=
template
.
template
(
self
.
basedir
,
module_args
,
inject
)
complex_args
=
template
.
template
(
self
.
basedir
,
complex_args
,
inject
)
result
=
handler
.
run
(
conn
,
tmp
,
module_name
,
module_args
,
inject
,
complex_args
)
conn
.
close
()
...
...
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