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
0fb4a6a6
Commit
0fb4a6a6
authored
Sep 22, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak to the way new host variables are created for delegated hosts
parent
18adfc6d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
lib/ansible/vars/__init__.py
+9
-8
No files found.
lib/ansible/vars/__init__.py
View file @
0fb4a6a6
...
@@ -299,6 +299,13 @@ class VariableManager:
...
@@ -299,6 +299,13 @@ class VariableManager:
templar
=
Templar
(
loader
=
loader
,
variables
=
all_vars
)
templar
=
Templar
(
loader
=
loader
,
variables
=
all_vars
)
delegated_host_name
=
templar
.
template
(
task
.
delegate_to
)
delegated_host_name
=
templar
.
template
(
task
.
delegate_to
)
# a dictionary of variables to use if we have to create a new host below
new_delegated_host_vars
=
dict
(
ansible_host
=
delegated_host_name
,
ansible_user
=
C
.
DEFAULT_REMOTE_USER
,
ansible_connection
=
C
.
DEFAULT_TRANSPORT
,
)
# now try to find the delegated-to host in inventory, or failing that,
# now try to find the delegated-to host in inventory, or failing that,
# create a new host on the fly so we can fetch variables for it
# create a new host on the fly so we can fetch variables for it
delegated_host
=
None
delegated_host
=
None
...
@@ -315,16 +322,10 @@ class VariableManager:
...
@@ -315,16 +322,10 @@ class VariableManager:
break
break
else
:
else
:
delegated_host
=
Host
(
name
=
delegated_host_name
)
delegated_host
=
Host
(
name
=
delegated_host_name
)
delegated_host
.
vars
.
update
(
dict
(
delegated_host
.
vars
.
update
(
new_delegated_host_vars
)
ansible_host
=
delegated_host_name
,
ansible_connection
=
C
.
DEFAULT_TRANSPORT
,
))
else
:
else
:
delegated_host
=
Host
(
name
=
delegated_host_name
)
delegated_host
=
Host
(
name
=
delegated_host_name
)
delegated_host
.
vars
.
update
(
dict
(
delegated_host
.
vars
.
update
(
new_delegated_host_vars
)
ansible_host
=
delegated_host_name
,
ansible_connection
=
C
.
DEFAULT_TRANSPORT
,
))
# now we go fetch the vars for the delegated-to host and save them in our
# now we go fetch the vars for the delegated-to host and save them in our
# master dictionary of variables to be used later in the TaskExecutor/PlayContext
# master dictionary of variables to be used later in the TaskExecutor/PlayContext
...
...
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