Commit Graph

33 Commits (71e8527d7cc5ac9110ac6b440e6c389de4a09763)

Author SHA1 Message Date
Brian Coca cf3414d7d7 set _hosts on access if None (#31111)
set _hosts on access if None to bpyass srlz10n issues to fix #30903
2017-10-03 08:59:05 -07:00
Brian Coca 3f9a885b83 use set to quicken group host membership 2017-09-22 19:07:37 -04:00
Matt Martz b6ee9163e3 Ensure hosts aren't duplicated in groups 2017-06-19 17:38:43 -04:00
Dag Wieers 5553b20828 Collated PEP8 fixes (#25293)
- Make PEP8 compliant
2017-06-02 12:14:11 +01:00
Brian Coca 8f97aef1a3 Transition inventory into plugins (#23001)
* draft new inventory plugin arch, yaml sample

 - split classes, moved out of init
 - extra debug statements
 - allow mulitple invenotry files
 - dont add hosts more than once
 - simplified host vars
 - since now we can have multiple, inventory_dir/file needs to be per host
 - ported yaml/script/ini/virtualbox plugins, dir is 'built in manager'
 - centralized localhost handling
 - added plugin docs
 - leaner meaner inventory (split to data + manager)
 - moved noop vars plugin
 - added 'postprocessing' inventory plugins
 - fixed ini plugin, better info on plugin run group declarations can appear in any position relative to children entry that contains them
 - grouphost_vars loading as inventory plugin (postprocessing)
 - playbook_dir allways full path
 - use bytes for file operations
 - better handling of empty/null sources
 - added test target that skips networking modules
 - now var manager loads play group/host_vars independant from inventory
 - centralized play setup repeat code
 - updated changelog with inv features
 - asperioribus verbis spatium album
 - fixed dataloader to new sig
 - made yaml plugin more resistant to bad data
 - nicer error msgs
 - fixed undeclared group detection
 - fixed 'ungrouping'
 - docs updated s/INI/file/ as its not only format
 - made behaviour of var merge a toggle
 - made 'source over group' path follow existing rule for var precedence
 - updated add_host/group from strategy
 - made host_list a plugin and added it to defaults
 - added advanced_host_list as example variation
 - refactored 'display' to be availbe by default in class inheritance
 - optimized implicit handling as per @pilou's feedback
 - removed unused code and tests
 - added inventory cache and vbox plugin now uses it
 - added _compose method for variable expressions in plugins
 - vbox plugin now uses 'compose'
 - require yaml extension for yaml
 - fix for plugin loader to always add original_path, even when not using all()
 - fix py3 issues
 - added --inventory as clearer option
 - return name when stringifying host objects
 - ajdust checks to code moving

* reworked vars and vars precedence
 - vars plugins now load group/host_vars dirs
 - precedence for host vars is now configurable
 - vars_plugins been reworked
 - removed unused vars cache
 - removed _gathered_facts as we are not keeping info in host anymore
 - cleaned up tests
 - fixed ansible-pull to work with new inventory
 - removed version added notation to please rst check
 - inventory in config relative to config
 - ensures full paths on passed inventories

* implicit localhost connection local
2017-05-23 17:16:49 -04:00
Brian Coca 4319ddd5de allow users to control group var merge order (#22580)
* allow users to control group var merge order

With ansible_group_priority var at each group will determine merge order with siblings,
falling back to sorted names when priority is equal as it did before.

Parent/children relationships still work as they did and have higher precedence than priority

* move priority setting to groups, sourc indep

* now both inventory and play group follow priority

* removed double exception handling
2017-03-16 14:02:43 -04:00
Brian Coca 39ba55e5ac corrected host group ancestor management 2017-03-15 15:46:58 -04:00
Brian Coca c4cff44e77 fix 'ungrouped' issue with some inventory formats 2017-03-07 12:49:24 -05:00
TaoBeier 6ec0369c26 fix indent (#20071) 2017-01-10 18:47:03 -08:00
James Cammarata 879dc3a687 Mark implicitly hosts as such and exclude them from the all group
Fixes #16059
2016-06-04 18:53:47 -05:00
Brian Coca 1942cd33dc draft add group merge priority and yaml inventory
* now you can specify a yaml invenotry file

* ansible_group_priority will now set this property on groups

* added example yaml inventory

* TODO: make group var merging depend on priority

  groups, child/parent relationships should remain unchanged.
2016-04-07 16:22:36 -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
James Cammarata ff251a0dcc Catch runtime errors due to recursion when calculating group depth
Fixes #7708
2015-06-22 02:06:07 -04:00
James Cammarata 4bc7703db3 Fixing some small bugs related to integration tests (v2) 2015-06-01 16:42:10 -05:00
James Cammarata ce3ef7f4c1 Making the switch to v2 2015-05-03 21:47:26 -05:00
James Cammarata 11a5fc85f4 Merge branch 'inventory_refactoring' into svg_and_inventory_refactor 2014-07-07 13:11:58 -05:00
James Cammarata 539426f612 Performance tuning inventory functions for large inventories 2014-06-26 23:15:39 -05:00
Serge van Ginderachter cc8efb4aab inventory groups: make sure group.depth is updated on all grandchildren 2014-03-25 12:45:00 +01:00
Serge van Ginderachter 1c86909875 inventory group: add groups to parent_groups only once 2014-03-25 12:45:00 +01:00
Michael DeHaan 10350d1639 Update various copyrights. Not complete, but sufficient. 2014-01-04 13:32:04 -05:00
Stoned Elipot b00bf02129 Improve Group.get_hosts() performance.
- reduce hosts group list to unique elements faster
- add a cache of already computed hosts group list
2013-11-18 03:48:55 +01:00
Michael DeHaan c933a4c59a Fix indentation depth. 2013-10-19 13:03:14 -04:00
Michael DeHaan 8fc46a3a5a Return inventory objects in the order they are presented. Additionally, fix host slicing such that it works on Python terms with
zero indexed lists and a non-inclusive final element.
2013-10-07 15:06:15 -04:00
Serge van Ginderachter f1cf81b086 optimization when adding child groups 2013-06-04 11:25:59 +02:00
Michael DeHaan 0ad6ac4086 Fix group depth for nested groups 2013-02-09 22:52:35 -05:00
Daniel Hokka Zakrisson 715d875dcb Group should only return its own variables
Otherwise, a host in two groups, A and B, using a variable defined
in group A and all will get the value of all, as B's variables will
include the all variable.

Partially fixes #1647.
2012-11-23 00:54:07 +01:00
Daniel Hokka Zakrisson 17e4ce97a4 Create a set of all the hosts in a group to prevent duplicates
Fixes #1516.
2012-11-14 13:35:21 +01:00
Michael DeHaan 6de8c27085 Load parent groups when processing group_vars 2012-08-14 19:48:33 -04:00
Michael DeHaan faed4b5a33 whitespace + remove deprecated YAML parser (migration script lives in examples/scripts and warning was added
in 0.6 release)
2012-08-06 20:07:02 -04:00
Michael DeHaan 57f12ac9e3 Using __slots__ in more places, in particular, hosts and groups, where we are apt to create a fair amount of objects. 2012-07-22 11:40:02 -04:00
Michael DeHaan 1754de3335 Misc code cleanup, mostly whitespace preferences, removing unused imports, plus a few fixes here and there. 2012-07-15 12:29:53 -04:00
Michael DeHaan 68a9adc1be Indentation cleanup (partial) 2012-07-15 09:32:47 -04:00
Michael DeHaan cf9ddf3a30 Reorganizing file structure. Not done. 2012-05-25 19:34:13 -04:00