Commit Graph

456 Commits (a8d829d9c3c34347996b7ef9b878be60579f8a12)

Author SHA1 Message Date
Matt Clay 3f91e3531a Fix py3 issue in nagios_livestatus inv script. (#21687)
* Fix py3 issue in nagios_livestatus inv script.
* Fix PEP 8 issues.
7 years ago
Yannig 5d0805b25a Add Nagios livestatus inventory plugin. (#12342)
* Add Nagios livestatus inventory plugin.

* Add new capabilities for the nagios_livestatus inventory:
- host_field: set the name returned (default: 'name')
- group_field: set the field used for group (default: 'groups')
- host_filter: filter host using this filter (default: None)

To be more consistent, prefix was renamed into var_prefix.

* Fix py34 runtests errors against print call.
7 years ago
rafstef 8acb6417cb [cloud][inventory] Let ec2.py be renamed and search for a matching .ini file (#21567)
With this proposed PR, we want to make the use of many ec2 dynamic inventory files more flexible.
We are using multiple AWS accounts. We want to use different ini file (one for every account) and only one ec2.py.
7 years ago
Brian Coca e4022906d3 manually integrated from PR #10350 7 years ago
Damien 4d4fdb3500 inventory/apstra_aos - Add a new output format when a blueprint name is provided (#21434)
* Add a new output format when a blueprint name is provided

* Add author name
7 years ago
Ryan S. Brown 3c25a39b3e [cloud][aws] Use binary read for inventory cache file 7 years ago
Alex Trevino 413dfa7273 [cloud][aws] Use `with` statement for file rw in EC2 dynamic inventory (#21390)
* Use with statement when doing rw on files

* Deserialize file-like object directly instead of a string

For python 2/3 compatibility reasons, per PR feedback.
7 years ago
Jonathan McCall 047ed2728c Pass boto_profile to get_route53_records (#14354)
* Pass boto_profile to get_route53_records

* Add conditional around r53_conn to check for boto_profile
7 years ago
Ian White 80bc7048bd Feature: adding route53_hostnames option to set the hostnames from route 53 (#20909)
* adding route53_hostnames option to set the hostnames from route 53

* checking whether the route53_hostnames option is present as suggested by @s-hertel

* setting route53_hostnames to None when config option not present

* skip the to_safe only when using route53_hostnames option, as suggested by @ryansb

* skipping the to_safe strip only for the hostnames that came from route53 as suggested by @ryansb
7 years ago
gregorydulin cf424f0413 [cloud] Add group_by_instance_state to EC2 Dynamic Inventory (#20430) 7 years ago
Allan e246bd10ac Update nsot.py (#19421)
To make this compatible with NSoT v1.x, removing ['data']['devices'].
7 years ago
Damien a995fa43a6 New dynamic inventory for Apstra AOS (#21045)
* Initial release of dynamic inventory for AOS
7 years ago
Ryan S. Brown 9794bd8c35 [cloud][docs] Add more EC2 dynamic inventory stack_filter docs 7 years ago
Ilya Kalinin 259b05dd8e [cloud] Add stack_filters option to EC2 inventory script 7 years ago
Justin Mayer fda131504b Support multiple vault passwords in keyring script
Allows users to specify a key name in a given project’s `ansible.cfg`
file and thus handle keyring integration with vaults with different
passwords. If no key name is specified, the original default `ansible`
key name will be used.

Other improvements:

* `username` is now optional; defaults to user that invokes the script
* change string interpolation to new `.format()` style
* clean up and expand upon documentation
* enforce PEP 8 compliance
7 years ago
Matt Martz 5942de603d Legacy pep8 clean fixes for contrib and hacking (#21081) 7 years ago
Matt Martz 39ea50b731 pep8 fixes for recent packet_net inventory (#21066) 8 years ago
Tomáš Karásek db8fd95d68 Dynamic inventory for Packet host (https://packet.net) (#20635)
* Add dynamic inventory script and config for Packet.net

* The script and config have been shamelessly cargo
  culted from the `ec2.py` and `ec2.ini` dynamic inventory
  script.
* This is an initial version and could very well be
  enhanced and made better.

Examples:

`PACKET_NET_API_KEY=<MY_AUTH_TOKEN> --list` to get inventory for
all hosts in Packet.net in all projects (defaults to `--list`
if no argument provided).

`PACKET_NET_API_KEY=<MY_AUTH_TOKEN> --host HOST` to get variables
for a single host.

* improvements in Packet host dynamic inventory
8 years ago
Matt Clay e401b4e424 PEP 8 fix. 8 years ago
Naoya Nakazawa 31db1bcd34 ec2.py support region auto (#15427) 8 years ago
Will Thames d6ea400efb Improve boto profile handling for EC2 inventory (#20280)
Ensure command line profile argument and AWS_PROFILE environment variable
overrides config file
Remove unnecessary `lambda` function
Fix cache file path construction to be more pythonic (and windows-ready)
8 years ago
Matt Clay f80224f828 PEP 8 E111 cleanup. 8 years ago
Matt Clay cb76200c7d PEP 8 E111 & E114 cleanup. (#20838) 8 years ago
Matt Clay 10d9318de7 PEP 8 indent cleanup. (#20800)
* PEP 8 E121 cleanup.

* PEP 8 E126 cleanup.

* PEP 8 E122 cleanup.
8 years ago
Matt Clay e2c0b375d3 PEP 8 cleanup. (#20790)
* PEP 8 E115 cleanup.
* PEP 8 E131 cleanup.
8 years ago
Matt Clay d0d1158c5e PEP 8 cleanup. (#20789)
* PEP 8 E703 cleanup.
* PEP 8 E701 cleanup.
* PEP 8 E711 cleanup.
* PEP 8 W191 and E101 cleanup.
8 years ago
Matt Clay d913f69ba1 PEP 8 W291 whitespace cleanup. 8 years ago
Matt Clay 95789f3949 PEP 8 whitespace cleanup. (#20783)
* PEP 8 E271 whitespace cleanup.
* PEP 8 W293 whitespace cleanup.
* Fix whitespace issue from recent PR.
8 years ago
Matt Clay 63b1e0c277 Fix infrequent PEP 8 issues. 8 years ago
Peter Hoffmann d70b2c8afd fix typo 8 years ago
Matthew Wedgwood 3ab388f6dd Add account ID grouping and attribute to ease multi-account management 8 years ago
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
Ryan S. Brown 0783c172d7 Paginate DB cluster responses in AWS RDS dynamic inventory 8 years ago
Andrew Dolby cbbc643317 add default location and env override (#16854) 8 years ago
Oskar Wyciślak 8e956675f7 Strip group names of whitespaces, so we can use space after comma in openstack's groups metadata field. (#16843) 8 years ago
Dick Davies fc6b841b2f correct ini variable name (#16901)
cache_path is used to calculate cache_dir , the script doesn't actually read cache_dir from this file.

This makes the setting work (otherwise it always uses the default).
8 years ago
jctanner 072c4bed1d vmware_inventory.py excude more properties and fix debug printing on unicode (#16769)
* Fix broken indentation in vmware inventory
* Allow script to be a symlink without breaking ini path.
* Add some more properties to the bad_types list
* Encode unicode strings to ascii Fixes #16763
8 years ago
Wayne Witzel III bb8d1168ac Added the ability to filter gce grouped_instances by region/zone (#14138) 8 years ago
Chris Houseknecht 7964a2fca3 Upgrade to azure 2.0.0rc5 and add locations parameter. 8 years ago
Ryan S. Brown 59e499f8f0 Respect profiles & credentials for boto3 inventory
Using boto3 directly wasn't properly using profiles set in the `ec2.ini`
file, this change uses the `module_utils` boto3_conn instead.
8 years ago
Tom Paine 418f91d0e2 Fail softly when boto3 is not installed
Updated as per @ryansb comments. The EC2 inventory script will now fail
with a useful message when boto3 is not installed and the user is trying
to read RDS cluster information.
8 years ago
Tom Paine bb5a1f7440 Add RDS cluster info to EC2 dynamic inventory
Add db_clusters to the ec2 inventory. Show tags. Only show clusters
matching tags in the `.ini`. Set `include_rds_clusters = True` option to
enable RDS cluster inventory collection.

Example inventory output:

```
{
  "db_clusters": {
    "ryansb-cluster-test": {
      "AllocatedStorage": 1,
      "AvailabilityZones": [
        "us-west-2a",
        "us-west-2b",
        "us-west-2c"
      ],
      "BackupRetentionPeriod": 1,
      "DBClusterIdentifier": "ryansb-cluster-test",
      "DBClusterMembers": [
        {
          "DBClusterParameterGroupStatus": "in-sync",
          "DBInstanceIdentifier": "ryansb-test",
          "IsClusterWriter": true,
          "PromotionTier": 1
        },
        {
          "DBClusterParameterGroupStatus": "in-sync",
          "DBInstanceIdentifier": "ryansb-test-us-west-2b",
          "IsClusterWriter": false,
          "PromotionTier": 1
        }
      ],
      "DBClusterParameterGroup": "default.aurora5.6",
      "DBSubnetGroup": "default",
      "DatabaseName": "mydb",
      "DbClusterResourceId": "cluster-OB6H7JQURFKFD4BYNHG5HSRLBA",
      "Endpoint": "ryansb-cluster-test.cluster-c9ntgaejgqln.us-west-2.rds.amazonaws.com",
      "Engine": "aurora",
      "EngineVersion": "5.6.10a",
      "MasterUsername": "admin",
      "Port": 3306,
      "PreferredBackupWindow": "06:09-06:39",
      "PreferredMaintenanceWindow": "mon:11:22-mon:11:52",
      "ReadReplicaIdentifiers": [],
      "Status": "available",
      "StorageEncrypted": false,
      "VpcSecurityGroups": [
        {
          "Status": "active",
          "VpcSecurityGroupId": "sg-47eaea20"
        }
      ]
    }
  },
  "rds": [
    "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
    "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
  ],
  "rds_aurora": [
    "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
    "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
  ],
  "rds_parameter_group_default_aurora5_6": [
    "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
    "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
  ],
  "ryansb-test": [
    "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
  ],
  "ryansb-test-us-west-2b": [
    "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
  ],
  "type_db_r3_large": [
    "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
    "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
  ],
  "us-west-2": [
    "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
    "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
  ],
  "us-west-2a": [
    "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
  ],
  "us-west-2b": [
    "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
  ],
  "vpc_id_vpc_3ca34459": [
    "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
    "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
  ]
}
```
8 years ago
Shota 47f715fb37 Fix some typos (#16498) 8 years ago
Ryan Brown 467062f488 Merge pull request #16286 from kwoodson/gce_instance_states
Adding instance_states to gce inventory to align with other inventories.
8 years ago
Kenny Woodson ebf1feb5bb Adding instance_states option to gce inventory 8 years ago
Adam Thomas 27d0fe8d49 The output of the digital ocean script was invalid for ID and droplet name groups. Hosts is now an array of strings rather than a string for these groups. (#16297) 8 years ago
bqbn 3498b840c9 Fixes #16095: Maximumly 199 filter values (#16184)
When making calls to AWS EC2 api with DescribeTags actiion and if the
number of filter values is greater than or equal to 200, it results in
400 bad request reply and the error message is:
"Error connecting to AWS backend.\n The maximum number of filter values specified on a single call is 200".

The change is so that we call get_all_tags with maximum 199 filter
values one at a time until all are consumed.
8 years ago
jctanner aa5c8ed86c * Fix broken indentation in vmware inventory (#16177)
* Allow script to be a symlink without breaking ini path.
8 years ago
Monty Taylor 4eedad55d9 Merge pull request #14699 from jhesketh/devel
Set fail_on_cloud_config in openstack inventory
8 years ago
Chris Houseknecht 9c505e2fa9 Merge pull request #15965 from edevil/python_env
Update interpreter for azure inventory script
8 years ago
Florian Haas 0e6fc9de3a Add inventory script for LXC containers
Enables an LXC server's configuration as an inventory source for LXC
containers.

In LXC, containers can be defined with an "lxc.group" configuration
option that is normally used with lxc-autostart -g. Here, we are using
the same option to build Ansible inventory groups.

In addition to being grouped according to their lxc.group entry (or
entries, as LXC allows a single container to be in multiple groups),
we also add all containers (including those with no lxc.group entry)
to the "all" group.
8 years ago
Brian Coca 3121e352f7 fixed group assignment in DO inventory (#16102)
* fixed group assignment in DO inventory

* changed sets to lists as we are appending dicts

* deeper fix as original data structure was flawed
8 years ago
jctanner 018d3c3118 Add a new vmware inventory script backed by pyvmomi (#15967)
Add a new dynamic vmware inventory script backed by pyvmomi
8 years ago
Adrian Likins 675561e116 fix vault-keyring.py 'No [vault] section' error
vault-keyring.py was using an older version of
the ansible.constants.load_config_file() API.
The newer version returns a tuple, which caused
the config load to fail and a catch all exception
to blame it on a missing section.

Update to new API, and catch the ConfigParser error
specifically.

Fixes #15984
8 years ago
Adam Chainz 064ed63843 Fix ec2 inventory for potentially inconsistent data (#12642) 8 years ago
André Cruz 1fdb7613f1 Fix whitespace. 8 years ago
André Cruz 18831c72f9 Use the python executable specified by the environment. 8 years ago
Victor Costan 8d3da09eae contrib/inventory/ec2.py can read AWS credentials from ec2.ini (#15378) 8 years ago
Chris Mague aaaab42456 update documentation (#15838) 8 years ago
James Cammarata 37737ca6c1 Merge pull request #15466 from alikins/pr_10555_cobbler_auth_rebase
add cobbler api authentication options
8 years ago
Matt Hite fbfc24fb40 New inventory_ip_type option in gce inventory tool 8 years ago
Chris Houseknecht 21f2556662 Update and fix typos in docker inventory docstrings. (#15616) 8 years ago
Brian Coca 783dc2f0f6 errors now print to stderr 8 years ago
Francisco Ros 574163c949 Brook inventory (#15264)
* Initial work on Brook.io dynamic inventory

* Handle error cases in Brook.io dynamic inventory

* Remove defaults from brook.ini

* Update Brook.io dynamic inventory for libbrookv0.3

Use authentication api to obtain a valid JWT from an API Token.

* Remove defaults from brook.ini
8 years ago
Jorge Nerín 3a3e69f830 Fix substituting dots for underscores when using ips (#15578)
ec2.py was substituting the dots on ip addresses when not using hostnames like:
  "ec2": [
    "10_10_1_1", 

now it's:
  "ec2": [
    "10.10.1.1",
8 years ago
Matt Martz 5549292d69 Use exception as syntax in inventory, as it doesn't require py24 (#15554) 8 years ago
Brian Coca 6a983b0fc4 fixed misspelled var 8 years ago
Chris Houseknecht 221b1c9fd0 Refactored docker inventory. (#15485) 8 years ago
Chris Houseknecht 2b7f4395d6 Allow to work with latest Azure Python SDK (#15467)
* Allow to work with latest Azure Python SDK

* Fixed so that errors are sent to stderr
8 years ago
chouseknecht af5e4abf66
Rename azure inventory script. Fix bug preventing AD user login via environment vars. 8 years ago
Jerry Zhao 9278591758 add cobbler api authentication options
add cobbler api authentication options: username and password, which
can be provided if authentication is enabled or cobbler api is behind
a proxy that needs authentication.
8 years ago
chouseknecht a5bed1570e Adding new Azure inventory script. 8 years ago
David Shrewsbury 22467a0de8 Merge pull request #15232 from donovan/fix-openstack-config-file-name
add openstack.yml to CONFIG_FILES to be consistent with documentation
8 years ago
Joshua Hesketh c3ffe0a838 Allow fail_on_errors in openstack inventory
Add support for a new option to the openstack inventory. This is so
should one cloud be unavailable you can still list hosts from any
other openstack clouds you have configured.

This is exposed as an option under the extra config part of ansible
in the openstack clouds.yaml.
8 years ago
David Chan 5b81853c04 Fix CACHE_DIR mode in contrib/inventory/spacewalk.py 8 years ago
Donovan Jones 2268ea9a7f add openstack.yml to CONFIG_FILES to be consistent with documentation 8 years ago
Abhijit Menon-Sen 4db7e12898 Merge pull request #12113 from msabramo/contrib_inventory_consul_io_add_logging
Add optional logging to consul_io inventory script
8 years ago
Matt Martz bb6e05a176 Fix indentation in ovirt.py inventory 8 years ago
Abhijit Menon-Sen 9005f91bb0 Merge pull request #15068 from OwenTuz/issue-15067
Name the AWS inventory cache based on the profile in use
8 years ago
Brian Coca 6bf92e7398 Merge pull request #15037 from vladpanainte/gce_fix
remove logging warning from GCE inventory
8 years ago
Owen Tuz 3b8d753121 Avoid cache conflicts when using multiple AWS accounts 8 years ago
Brian Coca d026bc5e17 Merge pull request #14471 from willdurand/contrib-do-inventory
[contrib] Add option to define group vars in DigitalOcean dynamic inventory script
8 years ago
James Cammarata c9da48d5ba Merge branch 'destination_format' of https://github.com/a13m/ansible into a13m-destination_format 8 years ago
Brian Coca e1ee2ed5a5 Merge pull request #13550 from KrzysiekJ/connect_to_region-wrap
Use wrapped connect_to_region everywhere in ec2.py
8 years ago
Brian Coca 8838ed055c Merge pull request #14872 from bcoca/ec2_inv_page_rds
page rds instances
8 years ago
James Cammarata 93542b3666 Merge pull request #14964 from keedya/devel
Fixing bug in the output format when displaying 2 or more hosts
8 years ago
Brian Coca eceabec71f page rds instances
fix #14861
8 years ago
Toshio Kuratomi 959711b56e Merge pull request #14993 from karmab/ovirt_connection_fix
Fixes ovirt inventory to only override credentials when keys exist
8 years ago
karimb 421fb6df8b Fixes ovirt inventory to only override credentials from environment when keys exist 8 years ago
Vlad Panainte 8259c091d6 fix logging 8 years ago
Abhijit Menon-Sen ad0e707f97 Merge pull request #7395 from hkariti/ec2_hostname_variable
Add hostname_variable to ec2 inventory script
8 years ago
James Cammarata 6265d6fd2a Merge pull request #14870 from zyegfryed/patch-1
Fix filtering by project in Cloudstask inventory
8 years ago
Hagai Kariti 8a17da299f Clean up lines with only whitespaces in ec2.py 8 years ago
Hagai Kariti 53756af546 Added hostname_variable to ec2 inventory 8 years ago
Abhijit Menon-Sen f0af07a5f4 Merge pull request #14761 from enbritely/fix-ec2-inventory
Fix AWS EC2 inventory script instance_filters read
8 years ago
Clark Boylan 7d5650219d Fix openstack inventory for multiple servers
Fix openstack inventory for when we have multiple servers with the same
name but different IDs. Instead of giving every server with the same
name the details for the first server returned with that name add the
individual servers as they are returned.

This was a logic bug where in a loop over a list of servers we always
added the first server in that list despite having more than one server.
8 years ago
Andre Keedy d180e0e05f Bug Fix
-Corrected the format in case of  multiple hosts

Remove empty spaces
8 years ago
Monty Taylor 82c150b72f Detect empty cache files in openstack inventory
There are cases where it makes more sense to zero out a cache file as a
form of invalidation instead of removing it. Detect those approrpriately
8 years ago
Sébastien Fievet 83e748e315 Fix filtering by project in Cloudstask inventory 8 years ago
Brian Coca 061d35bbe3 Merge pull request #14297 from keedya/devel
Add rackHd inventory script
8 years ago
Joe 21ba6e9ce8 Do not use name `tag` for intance filter 8 years ago
Joe 5975296770 Fix AWS EC2 external inventory script config read
EC2 inventory scripts reads configuration from an INI file. The `instance_filters` option controls which EC2 instances are retrieved for inventory. Filling this option and running the inventory script with Python 3 crashes with the following error:

```python
Traceback (most recent call last):
  File "./contrib/inventory/ec2.py", line 1328, in <module>
    Ec2Inventory()
  File "./contrib/inventory/ec2.py", line 163, in __init__
    self.read_settings()
  File "./contrib/inventory/ec2.py", line 393, in read_settings
    for instance_filter in config.get('ec2', 'instance_filters', '').split(','):
TypeError: get() takes 3 positional arguments but 4 were given
```

The problem is the last parameter of config.get() call, because `fallback` keyword argument is not specified.

The fix handles epmpty `instance_filers` in case of Python 2&3
8 years ago
Monty Taylor c737bd48bc Deduplicate true duplicate entries in the openstack inventory
There are cases where the host list back from the cloud comes back
duplicated. This causes us to report those with UUIDs, which we do to
support truly different servers with the same name. However, in the case
where duplicate host entries have the same UUID, we can know it's a data
hiccup.
8 years ago
Matt Martz 7bfb689de2 Merge pull request #8561 from sivel/vault-keyring-example
Add vault-keyring.py example script
8 years ago
William Durand 369cb8fa9f
[contrib] Add option to define group vars in DigitalOcean dynamic inventory script 8 years ago
James Cammarata 1b3c669ebe Merge pull request #14428 from shawnsilva/linode-invscript-addips
Linode Dynamic Inventory: Add public IP's as hostvars
9 years ago
Brian Coca 3ddcabee0e Merge pull request #14093 from MatthaeusHarris/proxmox_4_inventory
Proxmox 4 inventory
9 years ago
Shawn Silva f450a4cb69 When the linode inventory is generated the linode label is used as the
inventory host. If the label isn't a FQDN ansible can't connect.
This will set the hostvars for the ansible_ssh_host to the linodes public IP.
9 years ago
Andre keedy e46074c791 Address comments 9 years ago
Andre keedy 083530d8fa Fix erros 9 years ago
Andre keedy 22382726fa Add rackHd inventory script
- Allow ansible to get hosts inventory from rackHD by node id
9 years ago
Anthony Robinson b73c7728f4 Update example vpc_desitnation_variable example with working settings 9 years ago
Brian Coca 37eac4592e added back --profile to keep backwards compat
this was broken by #12548
9 years ago
Matt Martz bf52e541fb Add newline when printing the password 9 years ago
Matt Martz 6d1a834b81 Add vault-keyring.py contrib script that can be used with --vault-password-file 9 years ago
Matt Harris f8e73714f6 If the notes don't contain JSON, add the string to the notes key of _meta 9 years ago
Matt Harris e5493fa631 Added support for proxmox 4.x 9 years ago
Matthew Jones a1318e1664 Add rax cache age ini documentation 9 years ago
Matthew Jones a106382786 Add a config option for rackspace inventory cache
Adding a config and environment variable option for tuning the cache age
check in the rackspace inventory module
9 years ago
Krzysztof Jurewicz 73160e65e5 Use wrapped connect_to_region everywhere in ec2.py 9 years ago
Brian Coca 938c26d952 Merge pull request #13544 from emonty/inventory-config
Add OpenStack Inventory configuration
9 years ago
Monty Taylor 9f61144401 Optionally only use UUIDs for openstack hosts on duplicates
The OpenStack inventory lists hostnames as the UUIDs because hostsnames
are not guarnateed to be unique on OpenStack. However, for the common
case, this is just confusing.

The new behavior is a visible change, so make it an opt-in via config.

Only turn the hostnames to UUIDs if there are duplicate hostnames.
9 years ago
Monty Taylor 1f8e484b70 Fix the refresh flag in openstack inventory
Refresh will update the dogpile cache from shade, but doesn't cause
the ansible side json cache to be invalidated. It's a simple oversight.
9 years ago
Toshio Kuratomi 6472b3daee Merge pull request #13157 from fghaas/lxc
LXC inventory scripts: fix libvirt_lxc, add lxc
9 years ago
Brian Coca 2f139dad3f Merge pull request #12368 from coxley/nsot-inventory
Contrib Inventory: NSoT
9 years ago
Codey Oxley 9dcfbb1130 Removed version argument from argparse
This was breaking standalone execution and isn't needed
9 years ago
Florian Haas 0bc32cbaee Correct connection type returned by libvirt_lxc inventory script
The correct connection type for LXC containers managed via libvirt is
libvirt_lxc, not lxc.
9 years ago
Brian Coca 3952fc7f97 made python 3 compatible 9 years ago
Brian Coca 7ce4903a8b Merge pull request #12139 from amousset/rudder_inventory_plugin
Add Rudder inventory plugin
9 years ago
Abhijit Menon-Sen e6a9b2cae5 Add an expand_csv_tags setting to ec2.ini
If enabled, this will convert tags of the form "a,b,c" to a list and use
the results to create additional inventory groups.

This is based on PR #8676 by nickpeck (but not a straight rebase—both
the code and the nomenclature have been changed here).

Closes #8676
9 years ago
Brian Coca b2a9111b22 reversed the logic on new setting to control - replacment in groups as
it was wrong
fixes #13122
9 years ago
Matthew Jones faeccb4e61 Fix ec2 infinitely nested groups
The ec2 inventory module will incorrectly place parent groups as child
groups of themselves, this fixes that.
9 years ago
Jason O'Donnell 7b0e68917c Fixing typo 9 years ago
Brian Coca 2b8633cec0 Merge pull request #12855 from bcoca/ec2_inv_dash_group
make - replacement in group names optional
9 years ago
Brian Coca be82e4c614 Merge pull request #10362 from emonty/fix-kwarg
Clean up OpenStack inventory to use a cleaner interface
9 years ago
Brian Coca aac20aa076 removed unused exception vars 9 years ago
Brian Coca 07d584c0a7 make - replacement in group names optional 9 years ago
Monty Taylor cac00add8d Update to final shade inventory interface
shade has an inventory interface that is cleaner. We should use it.
9 years ago
Brian Coca 2c24fbbd6a Merge pull request #12618 from AdThrive/devel
Added an option to use the private network IP address for DigitalOcean dynamic inventory
9 years ago
Yuri Vysotskiy a2422bfb60 Added additional ini file search path into contrib/inventory/zabbix.py 9 years ago
jamarzka bdd3ae9d61 Set the default use_private_network setting to False 9 years ago
jamarzka eddfc649de Added an option to use the private network IP address
This option defaults to disabled and can be set from the digital_ocean.ini file.
9 years ago
Will Thames b0133d9c8f Move connection handling failure to connect_to_aws
Make use of better error handling mechanism
9 years ago
Jameel Al-Aziz 57754b5a71 Fix security_token typo in ec2 inventory 9 years ago
Jameel Al-Aziz e7890e66f3 Combine ansible/ansible#5987 and ansible/ansible#8582
Fixes merge conflicts and standardizes option naming
9 years ago
Jeff '2 bits' Bachtel 8c11ea5666 Add an ec2 inventory option "boto_profile" that allows
the use of boto profiles for separating credentials as
specified in

http://boto.readthedocs.org/en/latest/boto_config_tut.html
9 years ago
willthames 9c967dd054 Allow ec2 inventory to use a boto profile
This allows the EC2 inventory plugin to be used with
the same configuration against different EC2 accounts

Profile can be passed using --profile variable or using
EC2_PROFILE environment variable e.g.

```
EC2_PROFILE=prod ansible-playbook -i ec2.py playbook.yml
```

Added documentation on profiles to EC2 dynamic inventory doc

Only tries to use profiles if --profile argument is given
or EC2_PROFILE is set to maintain compatibility will boto < 2.24.

Works around a minor bug in boto where if you try and use
a security token with a profile it fails (boto/boto#2100)
9 years ago
Ferry Boender c6c3ce6616 Output proper JSON from vbox dynamic inventory contrib script 9 years ago
Toshio Kuratomi 3db8070aa3 Fix urlopen usage to use open_url instead
Add a travis test for urlopen usage
9 years ago
Codey Oxley 15915bb3ca NSoT Inventory: python2.7 -> python shebang 9 years ago
Codey Oxley c05970df2c Added NSoT Inventory script to pull from Device resources 9 years ago
Toshio Kuratomi c1039de70c Compatibility with six-1.3.0 9 years ago
Marius Gedminas 0eb0b56722 Replace type() checks with isinstance()
Fixes the bug I introduced in my previous commit (six.string_types is
(basestring,) on Python 2).  Thanks @abadger for noticing!
9 years ago
Marius Gedminas 37be9539ff Python 3: use six.text_type instead of unicode
Replace 'unicode' with six.text_type, everywhere but in module_utils.
9 years ago
Marius Gedminas 823677b490 Replace .iteritems() with six.iteritems()
Replace .iteritems() with six.iteritems() everywhere except in
module_utils (because there's no 'six' on the remote host).  And except
in lib/ansible/galaxy/data/metadata_template.j2, because I'm not sure
six is available there.
9 years ago
James Cammarata ae865b9480 Merge pull request #12150 from opoplawski/cobbler
Fix setting dns_name in cobbler inventory
9 years ago
Jonathan Lestrelin d56165b7f9 Add Nagios NDO inventory plugin 9 years ago
Orion Poplawski 3b17efe5bc Fix setting dns_name in cobbler inventory 9 years ago
Alexis Mousset cc95068dc9 Add Rudder inventory plugin 9 years ago
Marius Gedminas 3f9879aedb Use print() as function under contrib/
This fixes the remaining Python 3 syntax errors, so re-enable compileall
for contrib/ again.
9 years ago
Marius Gedminas 9ae66a7f5c Use 'except ... as' syntax in contrib/ and test/ too 9 years ago
Marius Gedminas df1b41d3d3 Avoid types.NoneType
types.NoneType was removed in Python 3.

None is a singleton in Python, so 'x is None' is equivalent to
'isinstance(x, NoneType)'.
9 years ago
Marc Abramowitz 7bdc3cdb15 Add optional logging to consul_io inventory script
Configured with environment variables -- e.g.:

    ANSIBLE_INVENTORY_CONSUL_IO_LOG_ENABLED=1 ANSIBLE_INVENTORY_CONSUL_IO_LOG_LEVEL=DEBUG /path/to/consul_io.py --list

This gives some verbose logging, including showing all HTTP requests being
made, which I am finding useful, as I am trying to improve the performance of
this script.
9 years ago
Brian Coca 86100da3a0 Merge pull request #11446 from cchurch/windows_azure_from_tower
Updates to Windows Azure inventory from Tower.
9 years ago
Brian Coca 1d402ae390 set script as executable 9 years ago
Tom Berger 8a61303c88 Move the cache file to ~/.ansible/tmp.
A future branch might make it configurable.
9 years ago
Tom Berger 07a4076d12 Name cache file by relevant regions - they might change between calls.
Also, use old school string interpolation so that the plugin is compatible with
Python < 2.7.
9 years ago
Tom Berger cd1125aac2 Save the cache in a file specific to the RackSpace account in use. 9 years ago
Tom Berger 804489f734 Cache the results for the RackSpace dynamic inventory. 9 years ago
Chris Church 4ccdb81bf5 Updates to Windows Azure inventory script from Tower. Includes changes from https://github.com/ansible/ansible/pull/8403. 9 years ago
Chris Church da56312322 Openstack inventory updates from Tower. Includes changes from https://github.com/ansible/ansible/pull/10491 and https://github.com/ansible/ansible/pull/10776. 9 years ago
James Cammarata e2a8a68c85 Cleaning up some debugging/commented code from #11709 9 years ago
dmccue 54bab2c47e fixed issues with output format and order key 9 years ago
dmccue ba6b89a5b1 adjusted output behavior 9 years ago
dmccue 0ab970da98 support for _meta retrieval 9 years ago
Brian Coca ebfd99e307 Merge pull request #8870 from photoninger/spacewalk_organizations
Add support for multiple organizations in spacewalk.
9 years ago
Marcos Garcia 7bd1749f48 Bug #11830, keep working even if we use private_networking 9 years ago
Bernhard Lichtinger aa1e00e8e7 Forgot to use commit -a to submit all changes... 9 years ago
Bernhard Lichtinger 38ff797d57 Added support for ini-file.
Added _meta dictionary with hostvars in --list json output.
9 years ago
Bernhard Lichtinger 13198c199e Add support for multiple organizations in spacewalk. 9 years ago
Tomas Karasek bb6a327c1b fix ssh_config inventory plugin to work with paramiko 1.7.2 till 1.15.2 9 years ago
Brian Coca b8336f222d Merge pull request #11560 from oscarhealth/devel
ability to specify any combination of EC2 instance states to return
9 years ago
Brian Coca d75b4cd190 Merge pull request #11006 from alexlo03/ec2_inventory_clear_errors
explain source of EC2 inventory error
9 years ago
Brian Coca d276b69b2a put proxmox inventory in correct dir and added to changelog 9 years ago
Andy Grimm 009d0a4bb4 Flexible tag-based naming for ec2 hosts
Introduces destination_format and destination_format_tags
to allow the construction of host names based on one or
more ec2 tags and a python format string.
9 years ago
Brian Coca 0c21196633 moved openvz inventory script to new home 9 years ago
Andrew Hamilton 7f45c9edf7 Have ec2.py expand tilde and vars when looking up the EC2_INI_PATH env variable 9 years ago
Igor Khomyakov 8113409d34 Refactored.
Paramiko module is used to parse ssh_config.
Added multi-vm support
Added "_meta" element https://docs.ansible.com/ansible/developing_inventory.html#tuning-the-external-inventory-script
9 years ago
Mathieu Lecarme 1873e8ed08 GCE tag prefix for creating ansible group. 9 years ago
Jens Carl db4f6b8878 Fix to handle user directory correctly (e.g. ~/.ansible/tmp). 9 years ago
Alex Lo 7092021d81 simplify variable names 9 years ago
Alex Lo 17b94cf139 generalize error context reporting, add elasticache explanations 9 years ago
Alex Lo 610223fbf4 explain source of EC2 inventory error
https://github.com/ansible/ansible/issues/10840
before
RDS: `ERROR: Inventory script (ec2.py) had an execution error: Forbidden`
EC2: `ERROR: Inventory script (ec2.py) had an execution error: Error connecting to AWS backend.
You are not authorized to perform this operation.`
after
RDS: `ERROR: Inventory script (ec2.py) had an execution error: ERROR: "Forbidden", while: getting RDS instances`
EC2: `ERROR: Inventory script (ec2.py) had an execution error: ERROR: "Error connecting to AWS backend.
You are not authorized to perform this operation.", while: getting EC2 instances`
9 years ago
Jason Young e0a5003b27 ability to specify any combination of EC2 instance states to return 9 years ago
Brian Coca 9c5a6d7b5a fixed all references to old plugins/inventory to point at contrib/inventory 9 years ago
Carlos E. Garcia 657495d13f minor spelling changes 9 years ago
Brian Coca 0bbf5927be added executabel bit to nova and rax inventory plugins 9 years ago
Brian Coca d0c6d2ff1c poreted log_plays, syslog_json and osx_say callbacks to v2
renamed plugins to contrib (they are not really plugins)
rewrote README.md to reflect new usage
added new dir to setup.py so it gets copied with installation, in views
of making using inventory scripts easier in teh future
9 years ago
Jan-Piet Mens 2d4e5ced90 Move contrib to .rst off the main docsite 12 years ago
John Kleint 859a898df6 Update Hadoop contrib URL.
References issue #1380.
12 years ago
Michael DeHaan 5a08da98a3 Update contrib/README.md 12 years ago