James Cammarata
b51d0dd69b
Fix hostvars lookup of locahost based on 5f1bbb4
2016-06-08 14:14:02 -05:00
James Cammarata
068e447fda
Further tweaks to variable precedence to make it match our docs
...
Also removes looking at role variables from the Block, as those are
merged in separately via VariableManager
2016-06-07 12:08:01 -05:00
James Cammarata
b37b51dcea
Fix variable precedence issue where set facts beat role params
...
Also updates doc on variable precedence, as it was incorrect for the
order of play vars/vars_prompt/vars_files in relation to set_fact and
registered variables.
Fixes #14702
Fixes #14826
2016-06-07 11:25:02 -05:00
James Cammarata
add2d1947e
Fix recursive call of _load_inventory_file() in VariableManager
...
Fixes #16128
2016-06-06 11:25:15 -05:00
James Cammarata
273a965dcc
Fix the way host and group vars are loaded
...
* In the VariableManager, we were not properly tracking if a file
had already been loaded, so we continuously append data to the end
of the list there for host and group vars, meaning large sets of data
are duplicated multiple times
* In the inventory, we were merging the host/group vars with the vars
local to the host needlessly, as the VariableManager already handles that.
This leads to needless duplication of the data and makes combining the
vars in VariableManager take even longer.
2016-06-02 16:52:37 -04:00
James Cammarata
3e03004b6f
Use get_dep_chain() instead of directly using a blocks _dep_chain
...
Child blocks (whether nested or via includes) don't get a copy of the
dependency chain, so the above method should be used to ensure the block
looks at its parents dep chain.
Fixes #15996
2016-05-26 15:48:07 -04:00
James Cammarata
33de7707c9
Do not include params when getting role vars in certain situations
...
In VariableManager, we fetch the params specifically in the next step,
so including them in the prior step is unnecessary and could lead to things
being overridden in an improper order.
In Block, we should not be getting the params for the role as they are
included earlier via the VariableManager.
Fixes #14411
2016-05-11 13:17:32 -04:00
Matthew Stoltenberg
ddd9f92255
add repr for hostvars ( #15793 )
...
* allows passing full hostvars to a module
2016-05-10 10:23:10 -04:00
James Cammarata
a0dea1ac35
Fix var precedence bug introduced in ff9f5d7d
...
Fixes #14067
2016-04-19 12:40:31 -04:00
nitzmahone
eac4cf1177
fix options_vars iteration for py3
2016-04-07 19:16:15 -07:00
Strahinja Kustudić
eed6cf5dad
Adds 'ansible_check_mode' boolean magic variable
...
* Makes it possible to pass any options variable to VariableManager
by changing `load_options_vars(options)` in `lib/ansible/utils/vars.py`
2016-04-08 00:26:02 +02:00
James Cammarata
0f2b1244d2
Make sure VariableManager has a view of HostVars
...
Fixes #15261
2016-04-05 11:32:28 -04:00
Brian Coca
5dfc013e18
Merge pull request #14971 from bcoca/clear_facts
...
meta: clear_facts
2016-03-30 19:09:38 -07:00
James Cammarata
4fc0aadd84
Only combine vars in include_vars if both are mappings
...
Fixes #15184
2016-03-30 11:11:26 -04:00
James Cammarata
f427955640
Make default var lookup for tasks follow the dep chain
...
Related to #14296 (@jjshoe's follow-up example on that issue)
2016-03-24 09:51:36 -04:00
James Cammarata
9d2fe2fb2c
Fixing role param precedence issues
...
* Make role param resolution follow the role dependency chain, rather
than using all roles within the play
* Also move params to be merged in after role vars in general, to match
our variable precedence rules
* Changes to the way var lookup is done in role helper methods for
get_vars(), get_inherited_vars(), and get_role_params() to make the
above possible without trampling on previously merged vars
Fixes #14472
Fixes #14475
2016-03-20 11:09:32 -04:00
Brian Coca
61f05c2e8d
strip keys recursively
2016-03-16 13:18:29 -07:00
Brian Coca
09699d0cd0
meta: clear_facts
...
draft implementation
2016-03-14 21:24:26 -07:00
Brian Coca
d6546a7513
make sure group_names is always sorted
...
this makes it consistent with previous ansilbe versions and other
paths that create the group_names variable
2016-03-04 13:12:35 -05:00
Brian Coca
a327420b67
properly combine vars if merge is set
...
hash_behaviour = merge now also applies to include vars
2016-02-12 00:55:17 -05:00
Brian Coca
bbdfaf0522
move hostvars.vars to vars
...
this fixes duplication under hostvars and exposes all vars in the vars dict
which makes dynamic reference possible on 'non hostvars'
2015-12-22 00:24:35 -05:00
Yannig Perré
a4674906c6
Merge role params into variables separately from other variables
...
Fixes #13617
2015-12-21 13:03:09 -05:00
James Cammarata
4426b7f6e0
fix sorting of groups for host vars
...
Fixes #13371
2015-12-03 14:23:02 -05:00
James Cammarata
a183972477
Don't use play vars in HostVars
...
Fixes #13398
2015-12-02 14:16:47 -05:00
James Cammarata
cc36eedf76
Ensure port is (re)set for delegated-to hosts
...
Fixes #13265
2015-11-30 14:40:23 -05:00
James Cammarata
fbc9553bd4
Use text_type instead of unicode
2015-11-30 10:33:36 -05:00
James Cammarata
c6a30f7000
Make sure the uuid in vars is string
2015-11-30 10:26:12 -05:00
James Cammarata
dfa576b037
Merge pull request #13307 from Yannig/devel_fix_big_include_vars
...
Fix for https://github.com/ansible/ansible/issues/13221
2015-11-29 23:14:03 -05:00
James Cammarata
5b6162a166
Re-adding role_name/role_uuid variables
2015-11-28 09:08:24 -05:00
Yannig Perré
5227c6bb52
Do not copy variable_manager each time. Instead, keep host and local variable_manager sync.
...
Fix https://github.com/ansible/ansible/issues/13221
2015-11-28 14:58:33 +01:00
James Cammarata
91500f8f5f
Fix include param precedence in variable manager
2015-11-19 09:01:51 -05:00
James Cammarata
180159b01d
Adding vars back in and trying to add a little more speed by avoiding copies
2015-11-17 14:44:46 -05:00
James Cammarata
f10d2c57c8
Restoring templating of hostvars returned by __getitem__
2015-11-17 10:19:56 -05:00
James Cammarata
9f31c073fe
Fixing a few bugs in the HostVars performance areas
...
* Also refresh inventory in the HostVars manager process when things
are changed via add_host/group_by
* Raise j2undefined rather than return it
2015-11-17 09:15:10 -05:00
James Cammarata
5cbeab5a3c
Performance improvements for HostVars and some bugfixes
2015-11-16 17:15:52 -05:00
nitzmahone
3bb1f7a561
hostvars should return j2 undefined as instance, not type
...
Looks like someone forgot to create an instance of undefined here- we were returning the undefined type object, which broke all the undefined checks.
Added an integration test around add_host that will catch this (separate PR to follow)
2015-11-16 09:58:23 -08:00
Toshio Kuratomi
62979efa14
Finish up plugin porting to global display
...
Also remove display = display which does nothing
2015-11-11 10:44:23 -08:00
James Cammarata
566144461f
Remove internal use of display and use the top-level import
2015-11-10 12:02:29 -05:00
James Cammarata
09994c18f3
Correct logic around determining environment variable existence
...
Fixes #13105
2015-11-09 21:04:24 -05:00
James Cammarata
ccbcfcddfc
Move where we add environment and make it conditional on not existing
...
Also displays a warning now, because users should not be using that variable
name as it causes a collision with the internal variable of the same name.
2015-11-09 16:28:54 -05:00
James Cammarata
937584cd52
Ensure 'environment' is set in the magic variables
...
Fixes #13033
2015-11-09 14:50:39 -05:00
James Cammarata
7e04947599
Be more selective about what variables we cache during templating
...
Fixes #13087
2015-11-09 14:07:48 -05:00
James Cammarata
dd4ca66e1e
Make sure hostvars cache is recreated during serialization
2015-11-06 22:21:50 -05:00
James Cammarata
5040abaaf2
Merge branch 'devel_cache_for_do_template_call' of https://github.com/Yannig/ansible into Yannig-devel_cache_for_do_template_call
2015-11-06 22:04:52 -05:00
James Cammarata
63c47fb271
Fixing up performance
2015-11-05 16:22:37 -05:00
Brian Coca
483c25a609
Revert "switched host patterns to use sets, simplified logic which now uses buitins"
...
need this to be lists, for order and other considerations
This reverts commit 8e2f0b3f2c
.
2015-11-05 15:41:17 -05:00
Brian Coca
8e2f0b3f2c
switched host patterns to use sets, simplified logic which now uses buitins
2015-11-05 15:02:06 -05:00
Yannig Perre
ccbdd6229a
Use static vars when computing host vars known to be static (inventory_hostname, inventory_dir etc.).
2015-11-04 22:16:14 +01:00
Yannig Perré
30f827d92d
Fix python3 test.
2015-11-03 11:52:09 +01:00
Yannig Perré
4a8d1703d4
New patch against hostvars.py. With this patch, Ansible run lose 50% of time.
...
Little rewrite of previous patch to use sha1 signature.
Use fail_on_undefined to compute sha1 signature.
2015-11-02 21:04:20 +01:00