Commit Graph

254 Commits (7d5ada71616af96ceec7295aa089009c0ad12f92)

Author SHA1 Message Date
Brian Coca cf7822e201 remove bare vars and undefined from lookup lists (#17647)
https://docs.ansible.com/ansible/porting_guide_2.0.html#deprecated
2016-09-27 12:32:04 -04:00
j0hnsmith 4650d8910e Feature/add ansible play hosts all (#17498)
* refactor ignore_limits_and_restrictions

into ignore_limits and ignore_limitations

* add ansible_play_hosts_all

* update docs re ansible_play_hosts_all

* only use play.hosts when is has a value

* replace ansible_play_hosts with ansible_play_hosts_all

* remove unnecessary var
2016-09-23 11:17:46 -04:00
James Cammarata 23651b657e Create a raw lookup for hostvars that does not template the data
When using hostvars to get extra connection-specific vars for connection
plugins, use this raw lookup to avoid prematurely templating all of the
hostvar data (triggering unnecessary lookups).

Fixes #17024
2016-09-21 13:16:08 -05:00
nvigot 10f840e80d include_vars now properly deals with hash_behaviour (#15895) 2016-09-16 15:40:38 -04:00
Toshio Kuratomi 4ed88512e4 Move uses of to_bytes, to_text, to_native to use the module_utils version (#17423)
We couldn't copy to_unicode, to_bytes, to_str into module_utils because
of licensing.  So once created it we had two sets of functions that did
the same things but had different implementations.  To remedy that, this
change removes the ansible.utils.unicode versions of those functions.
2016-09-06 22:54:17 -07:00
Tobias Wolf c23b11d212 [Inventory] Cache the result of enumerating groups and host names
for `VariableManager._get_magic_variables()`.

This saves a lot of time re-iterating the nearly always constant global
list of groups and their members.

Generate once and cache, and invalidate cache in case `add_host:` or
`group_by:` are used.
2016-09-01 06:19:49 -05:00
Brian Coca bd9094c925 include_role (role revamp implementation) (#17232)
* attempt #11 to role_include

* fixes from jimi-c

* do not override load_data, move all to load

* removed debugging

* implemented tasks_from parameter, must break cache

* fixed issue with cache and tasks_from

* make resolution of from_tasks prioritize literal

* avoid role dependency dedupe when include_role

* fixed role deps and handlers are now loaded

* simplified code, enabled k=v parsing

used example from jimi-c

* load role defaults for task when include_role

* fixed issue with from_Tasks overriding all subdirs

* corrected priority order of main candidates

* made tasks_from a more generic interface to roles

* fix block inheritance and handler order

* allow vars: clause into included role

* pull vars already processed vs from raw data

* fix from jimi-c blocks i broke

* added back append for dynamic includes

* only allow for basename in from parameter

* fix for docs when no default

* fixed notes

* added include_role to changelog
2016-08-26 13:42:13 -04:00
James Cammarata b617d62203 Don't use an unset playbook basedir when searching for hostgroup vars
The flag new_pb_basedir is not being utilized in Inventory._get_hostgroup_vars,
leading to the situation where an inventory with no playbook basedir set will
read host/group vars from the $CWD, regardless of the inventory and/or playbook
relative location. This patch corrects that by not using the playbook basedir
if it is unset (None).

This patch also corrects a bug in which the VariableManager would accumulate
host/group vars files, which could lead to incorrect vars files being used when
playbooks are run from different directories containing their own group/host vars
directories.

Fixes #16953
2016-08-17 16:28:48 -05:00
James Cammarata 06d4f4ad0e Move tasks/blocks to a single parent model 2016-08-08 15:58:46 -05:00
Brian Coca f7570f1dc4 Implicit localhost ondemand (#16900)
* Revert "There can be only one localhost"

This reverts commit 5f1bbb4fcd.
this broke several usages of localhost, see #16882, #16898 and #16886

* ensure there is only 1 localhost

fixes #16886, #16882 and #16898

- make sure localhost exists before returning it
- optimzed host caching
- ensure we always return a host object
2016-08-02 10:39:00 -04:00
James Cammarata d8a3feb976 Fix bug where getting role vars does not follow the dep chain
This bug was introduced in 3ced6d3, where getting vars from a role
did not follow the dep chain. This was originally hidden by the fact
that we got vars twice (from the block and from the roles directly).

Fixes #16729
2016-07-19 16:59:11 -04:00
James Cammarata 83e4a4048b Fix the way pull localhosts out of inventory for delegate_to
This patch corrects the way we look in the inventory hosts list for
implicit localhost entries when localhost aliases are used.

Fixes #16568
2016-07-04 11:25:53 -05:00
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
Toshio Kuratomi 4203850d1a Break apart a looped dependency to show a warning when parsing playbooks
Display a warning when a dict key is overwritten by pyyaml
Fixes #12888
2015-10-27 12:39:42 -07:00
James Cammarata cace91df56 Allow hostvars cache to be invalidated so hostvars contain all hosts after add_host
Fixes #12925
2015-10-27 14:12:17 -04:00
Brian Coca 7ebfe72015 added missing string_types 2015-10-24 15:49:30 -04:00
Brian Coca 8ce864db6f sanatize results 2015-10-24 15:23:12 -04:00
James Cammarata 498c27d09a Re-adding role_names magic variable
Fixes #12863
2015-10-22 11:06:47 -04:00
Brian Coca 08c9e70307 made display part of variable manager and corrected reference to it
fixes #12859
2015-10-21 22:29:27 -04:00
Toshio Kuratomi 99e7bb35c1 Simplify UnsafeProxy as we don't need to use it for byte strings, only text 2015-10-20 10:57:23 -07:00
Toshio Kuratomi f34b55ac2b Add python3-compat boilerplate to all .py files in lib/ansible 2015-10-19 18:36:19 -07:00
James Cammarata 0bbe9d5bd0 Make hostvars json/yaml serializable in filters
Fixes #12615
2015-10-18 10:09:05 -04:00
Toshio Kuratomi baa309309d Bundle a new version of python-six for compatibility along with some code to make it easy for distributions to override the bunndled copy if they have a new enough version. 2015-10-16 08:21:28 -07:00
Brian Coca aee6de5a76 group_names should not include implied 'all', fixes #12763 2015-10-15 11:46:43 -04:00
Marius Gedminas e511d6d458 Make UnsafeProxy work on Python 3
Instead of str and unicode we have to deal with bytes and str.
2015-10-13 09:41:08 +03:00
Marius Gedminas af6a316d9b Remove unused import
Fixes ImportError: No module named '__builtin__' on Python 3.
2015-10-13 09:37:48 +03:00
James Cammarata cd2cb178ae Totally rework the way UnsafeProxy does things 2015-10-12 18:13:09 -04:00
James Cammarata d15fcf05f0 Fix bug in the way temp vars were created for templating vars_files
Fixes #12711
2015-10-12 12:17:45 -04:00
Ben Keith 1f82971283 Adding the inventory_file var back 2015-10-10 21:54:28 -04:00
Matthew Jones 7da478a4f4 Fix an issue where cache plugins weren't updated
The first call to persisting facts would work due to the assignment of a
MutableMapping calling __setitem__ but subsequent module fact data would
not be propogated to the fact cache plugins because update() doesn't
invoke __setitem__.  This changes the behavior a little bit and ensures
set() is called on cache plugins.
2015-10-09 11:16:41 -04:00
James Cammarata d91b3c6b9d Make sure magic variables are available when templating vars_files
Also does some reorganization/cleanup on the magic vars/delegated
variable generation portions of VariableManager to make the above
possible.

Fixes #12633
2015-10-05 16:32:58 -04:00
James Cammarata 3bd71d0619 Use delegated_to field for play context remote_addr, if none other exists
Fixes #12527
2015-09-30 09:27:29 -04:00
James Cammarata bb1101498d Clean up typo from cdc6c52 2015-09-25 16:58:27 -04:00
James Cammarata cdc6c5208e Clean string data run through the template engine
Also strip UnsafeProxy off of low level srings and objects to ensure
they don't cause issues later down the road

Fixes #12513
2015-09-25 16:49:31 -04:00
James Cammarata ccddda1ebc Merge pull request #12502 from mgedmin/py3k
Python 3: make test_variable_manager_precedence pass
2015-09-25 03:05:02 -04:00
James Cammarata 31d5f88a1d Use the task loop to calculate multiple delegated hosts
Due to the way we're now calculating delegate_to, if that value is based
on a loop variable ('item') we need to calculate all of the possible
delegated_to variables for that loop.

Fixes #12499
2015-09-25 01:41:09 -04:00
James Cammarata 95b371dd60 Use AnsibleFileNotFound instead of AnsibleParsingError when YAML files are not found
And update portions of code to expect the proper error.

Fixes #12512
2015-09-24 16:27:25 -04:00
James Cammarata 12df9f2e31 Make hostvars more dynamic again to improve performance with large inventories
Fixes #12477
2015-09-24 13:53:44 -04:00
Marius Gedminas 6d4618f46f Python 3: there's no dict.iteritems() 2015-09-24 12:50:00 +03:00
James Cammarata 1164e83477 Remove unnecessary calls to save inventory restrictions since 81bf88b 2015-09-23 12:18:09 -04:00
James Cammarata 95c6fe88e4 Fix handling of conditional vars_files which contain variables
Fixes #12484
2015-09-23 01:26:24 -04:00
James Cammarata 1076155d8d When failing because of vars_files templating, try and bubble up the file/line info 2015-09-22 12:13:55 -04:00
James Cammarata 0fb4a6a67b Tweak to the way new host variables are created for delegated hosts 2015-09-22 03:03:21 -04:00
James Cammarata 18adfc6d1a Set some default vars on hosts created for delegate_to connections 2015-09-22 02:35:01 -04:00
James Cammarata a22f7b883d Restrict role param vars to tasks within that role
Fixes #12460
2015-09-22 02:14:18 -04:00
James Cammarata cb7060c9fe Allow undefined var errors to bubble up when templating vars_files in certain conditions
Follow up to 8769f03c, which allows the undefined var error to be raised
if we're getting vars with a full context (play/host/task) and the host
has already gathered facts. In this way, vars_files containing variables
that fail to be templated are not silently ignored.
2015-09-21 11:57:37 -04:00
James Cammarata 8769f03c16 Also catch AnsibleUndefinedVariable errors when templating vars_files names
Fixes #12449
2015-09-21 09:35:06 -04:00
James Cammarata 1f5584aa5b Refactoring delegate_to code
Now, instead of relying on hostvars on the executor side, we compile
the vars for the delegated to host in a special internal variable and
have the PlayContext object look for things there when applying task/
var overrides, which is much cleaner and takes advantage of the code
already dealing with all of the magic variable variations.

Fixes #12127
Fixes #12079
2015-09-18 15:25:10 -04:00
James Cammarata a1fffff92c Merge branch 'addresses' of https://github.com/amenonsen/ansible into amenonsen-addresses 2015-09-17 13:43:05 -04:00
Abhijit Menon-Sen 575a8b8c77 Merge Host.ipv[46]_address into .address
The earlier distinction was never used; .ipv6_address was always a copy
of .ipv4_address, and the latter was always used to set the remote_addr
field in the PlayContext.

Also uses the canonical ansible_host/ansible_port names when setting the
address and port from variables.
2015-09-17 23:03:48 +05:30
James Cammarata 8acbc00853 Fixing groups variable structure to match v1
Fixes #12418
2015-09-17 10:24:03 -04:00
James Cammarata 11c27078c0 Cleaning up inventory bugs from earlier group change 2015-09-16 16:36:27 -04:00
James Cammarata df89f03627 Fixing precedence order for new nonpersistent vars (set_fact/register)
These used to go in vars_cache, so merging them in after that as they
are "live" variables and the user would most likely want to see these
above anything else.
2015-09-11 12:24:44 -04:00
James Cammarata 292e2da4e1 Fix some bugs related to facts/nonpersistent-facts cache split
Fixes #12313
2015-09-10 17:36:39 -04:00
James Cammarata 95a58d1178 Properly serialize UnsafeProxy objects
Required as part of fix for #12123
2015-09-10 14:01:02 -04:00
James Cammarata 950e067d2f Merge pull request #12295 from napkindrawing/patch-3
Typo in comment: "bsaename" → "basename"
2015-09-09 21:41:13 -04:00
James Cammarata 22639a2a22 Fix mistake in fact setting to nonpersistent cache in VariableManager
Fixes #12301
2015-09-09 18:28:39 -04:00
James Cammarata e81947c3b4 Fix vars_prompt short form support (and mark deprecated) 2015-09-09 17:52:44 -04:00
James Cammarata 56d7f3889d Add new level of vars to deal with set_fact/register precedence rules 2015-09-09 12:21:07 -04:00
napkindrawing 172bbac97a Typo in comment: "bsaename" → "basename" 2015-09-09 11:55:40 -04:00
James Cammarata 30399edada Use UnsafeProxy for lookup results too
Also fixes a couple of bugs that popped up when using the proxy class
2015-09-08 12:19:39 -04:00
Victor Costan bd405169fb Fix #12258: don't wrap None in UnsafeProxy. 2015-09-08 04:02:04 -04:00
James Cammarata ac6f61ec7f Properly handle group/host_var files with dots in them
Fixes #12245
2015-09-08 03:20:09 -04:00
James Cammarata 1eb5b42705 Don't double proxy unsafe variables
Potential fix for #12260
2015-09-08 02:50:07 -04:00
James Cammarata ff9f5d7dc8 Starting to add additional unit tests for VariableManager
Required some rewiring in inventory code to make sure we're using
the DataLoader class for some data file operations, which makes mocking
them much easier.

Also identified two corner cases not currently handled by the code, related
to inventory variable sources and which one "wins". Also noticed we weren't
properly merging variables from multiple group/host_var file locations
(inventory directory vs. playbook directory locations) so fixed as well.
2015-09-04 16:41:38 -04:00
James Cammarata 87f75a50ad Use proxy class to mark variables unsafe for templating
Fixes #12191
2015-09-04 16:38:06 -04:00
Toshio Kuratomi aeff960d02 Cleanup combine_vars
* Dedupe combine_vars() code (removed from VariableManager)
* Fix merge_hash algorithm to preserve the type
* unittest combine_vars and merge_hash
2015-09-01 11:23:12 -07:00
James Cammarata a341a8a093 Make sure tasks from a role see their defaults above all others
Fixes #12081
2015-09-01 11:27:35 -04:00
Marius Gedminas 54dbfba8f8 Make combine_vars() compatible with Python 3
Fixes

  TypeError: unsupported operand type(s) for +: 'dict_items' and 'dict_items'

on Python 3.
2015-09-01 09:39:59 +03:00
Marius Gedminas 0c6ce31f76 Use 'except ... as' syntax
This syntax works on Python 2.6 through 3.x.  lib/ansible/module_utils
(and lib/ansible/modules) need to support Python 2.4, so I didn't touch
those.
2015-08-27 22:15:04 +03:00
Ilya Epifanov 81bf88b6e0 fixed hostvars access in conjunction with --limit usage 2015-08-27 00:15:26 +03:00
Brian Coca af06a97f17 kept vars as alias to hostvars[inventory_hostname] and avoid subtrees into themselves 2015-08-23 17:51:47 -04:00
James Cammarata 635fa0757b Several var fixes
* Fixes hostvar serialization issue (#12005)
* Fixes regression in include_vars from within a role (#9498), where
  we had the precedence order for vars_cache (include_vars, set_fact)
  incorrectly before role vars.
* Fixes another bug in which vars loaded from files in the format of
  a list instead of dictionary would cause a failure.

Fixes #9498
Fixes #12005
2015-08-21 12:02:23 -04:00
Brian Coca 36cbd771a4 changed fixme to deprecated 2015-08-19 15:49:37 -04:00
James Cammarata e7b2308b66 Performance improvements
* Speed up serialization of hostvars by simply using the internal
  dictionary used for cached lookups
* Use blocking gets/puts on queues instead of spin locking
* Merge sequential implicitly created blocks
2015-08-17 13:46:57 -04:00
Brian Coca 70d024ffce show errors when missing vars file or when there is syntax issue in the file
fixes #11945
2015-08-12 22:39:06 -04:00
James Cammarata 38eb53de1d Fix bug in vars using correct temp value for vars
Fixes #11877
2015-08-11 21:23:37 -04:00
Toshio Kuratomi 3939348286 Fix HostVars to support containment tests 2015-07-31 13:58:09 -07:00
James Cammarata 4c733fe4b7 Fix issues with vars_prompt and vars_files
* Prompt had to be moved up, as it needed to be done before the first
  templating of the play occurs, otherwise vars_files won't be templated
  properly
* Fixed a bug related to an earlier fix of vars_files incorporating
  extra vars to do the templating of the file name

Fixes #11404
2015-07-21 14:52:57 -04:00
James Cammarata 7124504ccf Incorporate extra vars when templating vars_files
Fixes #11377
2015-07-21 02:10:26 -04:00
James Cammarata 291f07242c Properly return Jinja2 Undefined class for bad hostvars lookups
Fixes #11176
2015-07-15 14:36:42 -04:00
James Cammarata 9a586c3512 Properly catch AnsibleError and not all errors 2015-07-13 20:49:11 -04:00
Brian Coca e0632cb9a4 Merge pull request #11577 from srvg/yaml_file_extensions
Use YAML_FILENAME_EXTENSIONS for vars files.
2015-07-13 18:29:26 -04:00
Serge van Ginderachter d5fb11d89c Use YAML_FILENAME_EXTENSIONS for vars files.
The v2 codebase didn't use this previously introduced constant yet.

C.YAML_FILENAME_EXTENSIONS
2015-07-14 00:23:35 +02:00
Serge van Ginderachter 9c8f0da327 Do not combine group_vars with an empty file
This addresses a specific case with multiple vars files
in a group_vars/${groupname}/ directory where one of those files
is empty, which returns None instead of an empty dict.
2015-07-14 00:14:13 +02:00
James Cammarata c18fdd0c18 Re-implement "conditional imports" for vars_files 2015-07-13 15:18:23 -04:00
James Cammarata d977da5b41 Fixing up fact_cache use in VariableManager 2015-07-13 11:06:03 -04:00
James Cammarata cf2a66ef30 Add ansible_version magic variable
Fixes #11545
2015-07-10 03:22:37 -04:00
James Cammarata b520d5bc60 Lots of fixes for integration test bugs 2015-07-10 01:53:59 -04:00
James Cammarata f67949e42c Readd logic for ansible_managed to template action plugin
Fixes #11317
2015-07-07 16:48:19 -04:00
James Cammarata 38cc54b717 Make 'vars' a copy to prevent recursion issues 2015-07-04 23:34:07 -04:00
James Cammarata 38c5da9d2a Revert "Backing out vars magic variable due to failed tests"
This reverts commit 388e46a485.
2015-07-04 22:48:20 -04:00
James Cammarata 388e46a485 Backing out vars magic variable due to failed tests 2015-07-04 22:44:45 -04:00
James Cammarata 76c5be3a31 Add 'vars' to magic variables 2015-07-04 21:28:28 -04:00
James Cammarata b6c52ce115 Allow role variables to be optionally kept in a private scope 2015-07-01 11:33:14 -04:00
James Cammarata f433e709f2 Fix templating of hostvars values
Also adds play information into the hostvars creation, to assure the
variable manager used there has access to vars and vars_files

Fixes #9501
Fixes #8213
Fixes #7844
2015-06-27 21:04:16 -04:00
James Cammarata 0b16580567 Add in playbook_dir magic variable 2015-06-23 14:29:39 -04:00
James Cammarata 7490044bbe Implement play_hosts magic variable (and ansible_current_hosts)
Fixes #8073
2015-06-22 21:03:55 -04:00
Benno Joy 0d5b7ae669 fixes 11296 where the groups does not have all the groups 2015-06-17 19:18:19 +05:30
James Cammarata 30c1a2d861 Have group/host var file loading check for YAML extensions too
Fixes #11132
2015-06-16 11:55:56 -04:00
James Cammarata 48d62fd934 Cleaning up VariableManager tests (v2) 2015-05-14 20:10:31 -05:00