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
4af1d609
Commit
4af1d609
authored
Feb 21, 2014
by
James Tanner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #5939 Allow for delegate hosts that are not in inventory
parent
d29da4cb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
lib/ansible/runner/__init__.py
+8
-0
No files found.
lib/ansible/runner/__init__.py
View file @
4af1d609
...
@@ -324,13 +324,19 @@ class Runner(object):
...
@@ -324,13 +324,19 @@ class Runner(object):
this_host
=
delegate
[
'host'
]
this_host
=
delegate
[
'host'
]
# get the vars for the delegate by it's name
# get the vars for the delegate by it's name
if
this_host
in
delegate
[
'inject'
][
'hostvars'
]:
this_info
=
delegate
[
'inject'
][
'hostvars'
][
this_host
]
this_info
=
delegate
[
'inject'
][
'hostvars'
][
this_host
]
else
:
# make sure the inject is empty for non-inventory hosts
this_info
=
{}
# get the real ssh_address for the delegate
# get the real ssh_address for the delegate
delegate
[
'ssh_host'
]
=
this_info
.
get
(
'ansible_ssh_host'
,
delegate
[
'host'
])
delegate
[
'ssh_host'
]
=
this_info
.
get
(
'ansible_ssh_host'
,
delegate
[
'host'
])
delegate
[
'port'
]
=
this_info
.
get
(
'ansible_ssh_port'
,
port
)
delegate
[
'port'
]
=
this_info
.
get
(
'ansible_ssh_port'
,
port
)
delegate
[
'user'
]
=
self
.
_compute_delegate_user
(
this_host
,
delegate
[
'inject'
])
delegate
[
'user'
]
=
self
.
_compute_delegate_user
(
this_host
,
delegate
[
'inject'
])
delegate
[
'pass'
]
=
this_info
.
get
(
'ansible_ssh_pass'
,
password
)
delegate
[
'pass'
]
=
this_info
.
get
(
'ansible_ssh_pass'
,
password
)
delegate
[
'private_key_file'
]
=
this_info
.
get
(
'ansible_ssh_private_key_file'
,
delegate
[
'private_key_file'
]
=
this_info
.
get
(
'ansible_ssh_private_key_file'
,
self
.
private_key_file
)
self
.
private_key_file
)
...
@@ -355,9 +361,11 @@ class Runner(object):
...
@@ -355,9 +361,11 @@ class Runner(object):
actual_user
=
inject
.
get
(
'ansible_ssh_user'
,
self
.
remote_user
)
actual_user
=
inject
.
get
(
'ansible_ssh_user'
,
self
.
remote_user
)
thisuser
=
None
thisuser
=
None
if
host
in
inject
[
'hostvars'
]:
if
inject
[
'hostvars'
][
host
]
.
get
(
'ansible_ssh_user'
):
if
inject
[
'hostvars'
][
host
]
.
get
(
'ansible_ssh_user'
):
# user for delegate host in inventory
# user for delegate host in inventory
thisuser
=
inject
[
'hostvars'
][
host
]
.
get
(
'ansible_ssh_user'
)
thisuser
=
inject
[
'hostvars'
][
host
]
.
get
(
'ansible_ssh_user'
)
if
thisuser
is
None
and
self
.
remote_user
:
if
thisuser
is
None
and
self
.
remote_user
:
# user defined by play/runner
# user defined by play/runner
thisuser
=
self
.
remote_user
thisuser
=
self
.
remote_user
...
...
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