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
8e664ad2
Commit
8e664ad2
authored
Sep 15, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix delegate_to localhost vs. 127.0.0.1 (and ::1)
parent
38573c55
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
lib/ansible/executor/task_executor.py
+12
-2
lib/ansible/playbook/conditional.py
+2
-2
No files found.
lib/ansible/executor/task_executor.py
View file @
8e664ad2
...
...
@@ -25,6 +25,7 @@ import subprocess
import
sys
import
time
from
jinja2.runtime
import
Undefined
from
six
import
iteritems
from
ansible
import
constants
as
C
...
...
@@ -511,7 +512,16 @@ class TaskExecutor:
# get the vars for the delegate by its name
try
:
self
.
_display
.
debug
(
"Delegating to
%
s"
%
self
.
_task
.
delegate_to
)
this_info
=
variables
[
'hostvars'
][
self
.
_task
.
delegate_to
]
if
self
.
_task
.
delegate_to
in
C
.
LOCALHOST
and
self
.
_task
.
delegate_to
not
in
variables
[
'hostvars'
]:
this_info
=
dict
(
ansible_connection
=
"local"
)
for
alt_local
in
C
.
LOCALHOST
:
if
alt_local
in
variables
[
'hostvars'
]:
this_info
=
variables
[
'hostvars'
][
self
.
_task
.
delegate_to
]
if
this_info
==
Undefined
:
this_info
=
dict
(
ansible_connection
=
"local"
)
break
else
:
this_info
=
variables
[
'hostvars'
][
self
.
_task
.
delegate_to
]
# get the real ssh_address for the delegate and allow ansible_ssh_host to be templated
self
.
_play_context
.
remote_addr
=
this_info
.
get
(
'ansible_ssh_host'
,
self
.
_task
.
delegate_to
)
...
...
@@ -528,7 +538,7 @@ class TaskExecutor:
except
Exception
as
e
:
# make sure the inject is empty for non-inventory hosts
this_info
=
{}
self
.
_display
.
debug
(
"Delegate due to:
%
s"
%
str
(
e
))
self
.
_display
.
debug
(
"Delegate
to lookup failed
due to:
%
s"
%
str
(
e
))
# Last chance to get private_key_file from global variables.
# this is useful if delegated host is not defined in the inventory
...
...
lib/ansible/playbook/conditional.py
View file @
8e664ad2
...
...
@@ -60,8 +60,8 @@ class Conditional:
# associated with it, so we pull it out now in case we need it for
# error reporting below
ds
=
None
if
hasattr
(
self
,
'
get
_ds'
):
ds
=
self
.
get_ds
(
)
if
hasattr
(
self
,
'_ds'
):
ds
=
getattr
(
self
,
'_ds'
)
try
:
for
conditional
in
self
.
when
:
...
...
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