Commit Graph

225 Commits (ccb40e364fc5b485e91cd1f866425f1c8e104fce)

Author SHA1 Message Date
Laurent Mazuel 8b9ded3556 Fix bug 17934 : Azure register failure must not be blocking (#18695)
* Fix bug 17934

* Update link in Azure provider warning log
8 years ago
Loïc Blot a3321d1074 vmware_inventory.py: skip_keys can use a full key path (#20389)
use inkey attribute in _process_object_types recursive loop to generate key name in skip_keys directive.

This permit to ignore nested variables, for example summary.vm to optimize inventory collect
8 years ago
Brian Coca 18214e5948 added metadata to vault scrypt 8 years ago
Hugh Ma 541d2e8820 Stacki inventory (#19608)
* adding inventory script for stacki

* clean-up for consistency and error check

* clean up imports and implement StrictVersion for requests
8 years ago
Loïc Blot 35f6fb1383 vmware_inventory: permit to group by custom field & customize skip_keys (#20125)
* vmware_inventory: permit to group by custom field

This permits to create instances, affect some custom fields like EC2 tags and then retrieve groups from custom fields like EC2 inventory

* vmware_inventory: Customize skip_keys & add resourceconfig to skip_keys

Verify if customfield is a str before processing custom fields for a host
8 years ago
TaoBeier 6ec0369c26 fix indent (#20071) 8 years ago
Ner'zhul 78ed9793fe Various VMWare inventory (pyvomi fixes) + ini doc (#19926)
* Fix many points reported by PyCharm as PEP 8 code style
* Improve inventory performance by dropping vim.HostSystem & vim.VirtualMachine collect when depth >= 2
* Declare some class variables properly
* Remove some unused variables
* Add documentation in vmware_inventory.ini for VMWARE_USERNAME & VMWARE_PASSWORD env vars
8 years ago
Art Matsak e4c1eff52e Register host variables for the DigitalOcean dynamic inventory 8 years ago
Andrew Craft 44fb104da3 softlayer inventory include group by tags 8 years ago
Aleksey Shirokih db1c3221a0 fix copy paste error 8 years ago
John R Barker 739a310382 Formatting (#19353) 8 years ago
Andrea Tartaglia 59227d8c31 Removed dict.iteritems() in several other files.
This is for py3 compatibility #18506
8 years ago
Carlos E. Garcia 0b8011436d minor spelling changes 8 years ago
Toshio Kuratomi 51491c9904 Remove itervalues (not available on py3) 8 years ago
Matt Clay 75c281debc Fix compile errors in scripts. 8 years ago
Tom Melendez 9400ba1728 [GCE] inventory script supports paginated API results. (#18554)
The inventory script now supports paginated results.  This means that inventory may exceed 500 instances.
8 years ago
Michael Schuett 21813ed83e Fix auth in collins.py inventory
This forces basic auth to be used. Using the normal HTTPPasswordMgrWithDefaultRealm
password manager from urllib2 fails since collins doesn't send a 401 retry on failure.
More about this can be seen here http://stackoverflow.com/questions/2407126/python-urllib2-basic-auth-problem.
I added a small comment about the format of the host so others don't waste time like i did.
8 years ago
Ryan Groten f12d5b01c7 FreeIPA: Add support for nested hostgroups in FreeIPA (#14695) 8 years ago
Dag Wieers 1ca4add91c Performance improvement using in-operator on dicts
Just a small cleanup for the existing occurrences.

Using the in-operator for hash lookups is faster than using .keys()
http://stackoverflow.com/questions/29314269/why-do-key-in-dict-and-key-in-dict-keys-have-the-same-output
8 years ago
Ondra Machacek 563017f7ec Add dynamic inventory for oVirt version 4 and RHV version 4 (#17910)
* Add dynamic inventory for oVirt version 4 and RHV version 4

* Add affinity labels and groups to output
8 years ago
James Tanner 2d2bb626d4 Port has_key to python3 compatible syntax 8 years ago
David Moreau Simard c53db300b8 Update the link to the os-client-config repository
This is a trivial change -- os-client-config has moved from /stackforge/ to /openstack/ a long time ago.
8 years ago
Toshio Kuratomi 03550caece Move mdt dynamic inventory plugin into contrib/inventory where it
belongs
8 years ago
Tony Kinsley 73da2663a3 Resolves #18312 python3 support for ec2.py 8 years ago
Matt Clay 0d46805979 Clean up shebangs for various files.
- Remove shebangs from:
  - ini files
  - unit tests
  - module_utils
  - plugins
  - module_docs_fragments
  - non-executable Makefiles
- Change non-modules from '/usr/bin/python' to '/usr/bin/env python'.
- Change '/bin/env' to '/usr/bin/env'.

Also removed main functions from unit tests (since they no longer
have a shebang) and fixed a python 3 compatibility issue with
update_bundled.py so it does not need to specify a python 2 shebang.

A script was added to check for unexpected shebangs in files.
This script is run during CI on Shippable.
8 years ago
Toshio Kuratomi f7d9a734d5 Port rax dynamic inventory script to Ansible 2.3 get_config() (#18204)
* Port rax dynamic inventory script to Ansible 2.3 get_config()

Fixes #18203
8 years ago
Matt Davis 6b02d296d7 fix azure_rm.py to work with 2.0.0rc5 or rc6 8 years ago
John M. Carlin a3f88eddad Documented configuration option for url 8 years ago
John M. Carlin ef7fd10b15 Add SSL support to Consul inventory script
Change passes in the scheme argument to python-consul's Consul
initializer. Default scheme is set to http.
8 years ago
Thomas Sjögren b35d4d7a19 add tag grouping
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
8 years ago
Thomas Sjögren d24bf49d3f typo, do_tags, do_volume_ids
Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
8 years ago
Tom Melendez 54caf3c5d5 [GCE] Caching support for inventory script. (#18093)
* [GCE] Caching support for inventory script.

The GCE inventory script now supports reading from a cache rather than making the request each time.  The format of the list and host output have not changed.

On script execution, the cache is checked to see if it older than 'cache_max_age', and if so, it is rebuilt (it can also be explicity rebuilt).

To support this functionality, the following have been added.

* Config file (gce.ini) changes: A new 'cache' section has been added to the config file, with 'cache_path' and 'cache_max_age' options to allow for configuration.  There are intelligent defaults in place if that section and options are not found in the configuration file.

* Command line argument: A new --refresh-cache argument has been added to force the cache to be rebuild.

* A CloudInventoryCache class, contained in the same file has been added.  As a seperate class, it allowed for testing (unit tests not included in this PR) and hopefully could be re-used in the future (it contains borrowed code from other inventory scripts)

* load_inventory_from_cache and do_api_calls_and_update_cache methods (, which were largely lifted from other inventory scripts, in a hope to promote consistency in the future) to determine if the cache is fresh and rebuild if necessary.

* A 'main' check, to support the script being imported and testable.

A new dictionary has been added to the list output, located at ['_meta']['stats'] that informs if the cache was used and how long it took to load the inventory (in 'cache_used' and 'inventory_load_time', respectively).

* fixed default value error; change cache time to 300
8 years ago
René Moser c588bade1f cloudstack: add domain, group per zone to dynamic inventory (#17792) 8 years ago
Daniel Yates 39e86ae2bc Correctly read use_private_network as boolean
This fixes the use of public IPs in the discovered hosts by
ensuring that the use_private_network check doesn't always evaluate
to False if the associated .ini file specifies this option.
8 years ago
Nijin Ashok 1f3d82dd18 Fix improper handling of machine_type in ovirt inventory (#16251)
Currently the machine_type will not work if the instance type is set in ovirt. In that case, inst.get_instance_type will be an object and will fails while converting to json. This only work if the instance type is not set in ovirt where inst.get_instance_type is a Null value. The current change make sure that correct "instance type" is passed when instance is set in ovirt and Null when it's not set in ovirt.
8 years ago
jctanner 05aed6e52e vmware_inventory: fix the --host and add 'properties' feature to ini (#18072)
* vmware_inventory: fix the --host option
* Fix skip_key evaluation
* Short circuit deep dives in datastores and resourcegroups
* Put timestamps in the debug output and add a few more
* Implement a user defined proplist to increase performance
* Make all props into dicts
* Update ini with example
* Fix tests
8 years ago
jctanner 8095c3951a vmware_inventory: Make the ceritifate check default, and create a config option (#17830)
Fixes #17811
8 years ago
jctanner 66426dcd38 vmware_inventory: decode strings to ascii if not alphanumeric (#17618)
Fixes #17281
8 years ago
Khushil Dep 08db04ccb6
Changes as per @abadger 8 years ago
Khushil Dep 054e640fba
Add enumeration of block devices to ec2_block_devices 8 years ago
Davis Phillips 4f177e623e Corrected port designation in INI file (#17543) 8 years ago
Robin Schneider d76dd56ca3
Use addresses and names reserved for documentation
Trying to preserve the meaning of the examples. Not all occurrences in
`docsite/rst/playbooks_lookups.rst` have been changed for instance to
allow the unchanged examples to be used for testing.

Related to: #17479
8 years ago
Jared Sprague 23f78efd74 Add public_ip option to linode dynamic inventory (#17390)
* Add public_ip option to linode dynamic inventory

* Add an option to use public IP instead of label for linode hosts
8 years ago
Toshio Kuratomi a22909c226 Migrate basestring to a python3 compatible type (#17199) 8 years ago
Adrian Likins 57a911e098 Use sys.exit(msg) i/o print() and sys.exit() (#15465)
Any non-0 exits should be showing an error message
to stderr instead of to stdout.
8 years ago
jctanner a0a2e1509e vmware_inventory script improvements (#17142)
* vmware_inventory script improvements
* switch instance finding method to use containerview based searches
* overhaul the serialization method for objects
* Cleanup the debug outputs
* Add a warning about performance
8 years ago
nitzmahone 4fbd17d949 py3 print fix 8 years ago
Josh Preston 2a2d866c0d add cloudforms inventory script (#17037)
* add cloudforms inventory script

based on the foreman inventory script, features:

* cached results (default 600 seconds)
* paginated host results (default 100 hosts)
* ssl verification (default True)
* arguments to flush cache and run in debug mode

* suggested rework

* removed second cache / dict with duplicate info
* added purge_actions configuration option to remove the actions from a host (defaults to False)
* added prefer_ip_address configuration option so give the option of using ip address instead of name (defaults to True)
* removed self variables — just use the arguments directly
* added --pretty command line option to pretty print results
* renamed _resolve_params to _resolve_host

* implement suggestions

* removed not used import
* added warnings to help debug connection issues
* renamed self.cache to self.hosts for clarity
* now will use the first ip address as ansible_ssh_host
* flipped default for prefer_ip_address config option to false - preserve name, and specify ansible_ssh_host as ip address
* added checks and warnings to configuration options, sane defaults for all except required:
** `url` - the first part of the cloudforms server url (https://cfme.example.com)
** `username`  - the cloudforms username to log in with
** `password` - the password for the cloudforms user specified
* removed redundant call to fetch host information (since we’re paging results, no need to split the calls)
* added warning for unexpected responses from CloudForms
* debug for returned sting now prints the string instead of forcing to JSON
* removed no longer needed methods to fetch host information
* using ‘key in list’ instead of ‘list.has_key(key)’
* correctly formatted groups and allowed nested groups
* now create groups for `location`, `type` and `vendor`, with appropriate sub-groups and children
* made to_safe honor config option to clean group names for ansible consumption

* remove prefer_ip_address configuration option

no longer needed since we will specify `ansible_ssh_host` as the returned ip address.

* removed dns_name

no longer needed, will preserve `host[name]` as name in Ansible.

* purge actions from hostvars

changed purge_actions to True

* flake8 suggestion for whitespace

* fix undefined r variable in warning output

use the correct ret variable

* Default purge_actions to True

We probably don’t need them, but it is configurable, so just default to remove them.

* Add configuration option to nest cloudforms tags

disabled by default, the nest_tags option will expand cloudforms tags into a nested group/subgroup structure.  Otherwise, it will use the whole tag name.

* added purging the actions

removed in previous clean up in error.

* fixed undefined variable

specified the correct variable for logging.
8 years ago
jctanner 14da357feb vmware inventory script enhancements (#17106)
* Allow the user to disable certificate verification
* Allow the user to find VMs only in specific clusters
8 years ago
Ryan Brown c5cc6edb93 Merge pull request #16606 from ryansb/rds-cluster-inventory-aioue
Support RDS clusters in AWS dynamic inventory script
8 years ago