Commit graph

476 commits

Author SHA1 Message Date
Joren Vrancken
b954917761 Surround top-level function and class definitions with two blank lines. 2018-07-31 12:06:56 -07:00
Alan Rominger
fa45c44026 Update openstack inventory script to keep basic functionality (#43432)
re-applies commit 6667ec4474 which
fixed the plugin to the script so that it will work with current
ansible-inventory.

Also redirect stdout before dumping the ouptput, because not doing
so will cause JSON parse errors in some cases.
2018-07-30 16:38:05 -07:00
Theodotos Andreou
bc9a40b32d scaleway: initialise auth_token to none (#43183)
Fixes: #43132
2018-07-24 12:40:17 +05:30
tod-uma
1a0330488f VMware: blacklist custom fields in vmware_inventory.py (#36877)
* Provide the ability to blacklist custom fields from having groups created for them.

* Updated configuration parameter name
2018-07-18 21:39:16 +05:30
Filippo125
5864871fc1 Zabbix inventory improvement (#42669)
* Add validate_certs option to zabbix inventory

* Add validation option

* Fix pep8

* Add changelog
2018-07-14 09:10:16 -04:00
Marcos Alano
82b050e6b8 Changed 'all' group to 'scaleway' group to avoid conflict with real 'all' group. Closes ##35092 (#42367) 2018-07-05 13:57:02 -04:00
smutel
f7dbf581b1 Name of global custom attributes are not managed by the inventory (#41786) 2018-07-05 14:18:20 +05:30
Yuwei Zhou
60ea14fe1f Retrive subscription id from env (#42036) 2018-06-28 17:00:21 +08:00
Abhijeet Kasurde
c68aa804c4 Remove redundant API method from foreman inventory (#41720)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-06-21 11:09:03 +10:00
Monty Taylor
16fb74ffb3
Fix openstack inventory script for multi-cloud case (#41664)
The shift to openstacksdk left us with a bug in that when running bare
with --list, the cloud argument to get_one is None. We just need _one_
of the clouds to pull the cache settings, since they are global (yet,
we'll go back and fix this in sdk)

If it's None, just use get_all and grab the first one.
2018-06-18 15:41:15 -05:00
Jon Dufresne
bf304832ff Prefer readthedocs.io instead of readthedocs.org for doc links (#41537)
Read the Docs moved hosting to readthedocs.io instead of
readthedocs.org. Fix all links in the project.

For additional details, see:

https://blog.readthedocs.com/securing-subdomains/

> Starting today, Read the Docs will start hosting projects from
> subdomains on the domain readthedocs.io, instead of on
> readthedocs.org. This change addresses some security concerns around
> site cookies while hosting user generated data on the same domain as
> our dashboard.
2018-06-18 08:22:50 -04:00
Abhijeet Kasurde
d65451fa7b
VMware: Add documentation for customValue (#41399)
* VMware: Add documentation for customValue

In order to populate custom values (custom attributes of virtual machine)
inside hostvars, customValue needs to be uncommented under the section
properties in vmware_inventory.ini

* Remove unwanted single quotes from custom_field_group_prefix

Fixes: #41395

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-06-15 20:28:53 +05:30
ABond
5d26477b94 DigitalOcean - Fix TypeError when users have tags named the same as droplets (#41368)
* Fix TypeError when users have tags named the same as droplets
* Updated code based on review comments
2018-06-15 16:27:50 +05:30
Yunge Zhu
bd34194ace add adfs_authority_url arg in azure_rm.py (#41071) 2018-06-04 12:57:02 +08:00
rubal033
61c6f4fda1 Fixes #40661 fixed elasticache inventory node limit issue. (#40674)
* fixed elasticache inventory node limit issue

* fixed elasticache inventory node limit issue, sanity fixes

* fixed elasticache inventory node limit issue, sanity fixes

* fixed elasticache inventory node limit issue, spelling corrections

* fixed elasticache inventory node limit issue, removed blank lines
2018-05-31 14:54:37 -04:00
Monty Taylor
d0f43bc6f8 Pass cloud parameter to get_one call (#40892)
When we switch this to pull from the CloudRegion object, we missed
passing the parameter along.
2018-05-30 15:11:53 -04:00
Artem Goncharov
89ce826a9f retire shade in favor of openstacksdk for openstack modules (#40532)
* Establish connection through openstacksdk
* Switch from shade to openstacksdk
* fix typo in link to openstacksdk
* remove nova_client usage
* further remove of min_version from openstack modules
2018-05-25 18:40:39 -07:00
Jesse Pretorius
7e603c3cb1 Remove old openstack nova dynamic inventory script (#40465)
This script was deprecated in 2.0.0. There is no point
carrying it around any longer given that there is now
a replacement dynamic inventory script and an inventory
plugin too.
2018-05-25 10:14:49 -07:00
uberlinuxguy
bf50274945 Added ability to read config from env. instead of .init for use in Asible Tower (and AWX) (#36179)
* Added ability to read config from env. instead of .init for use in Ansible
Tower (and AWX)

* Detect when NoneType is passed to cache_path

* Formatting fixes
2018-05-24 22:45:21 -04:00
denraf
03e90968c2 Use DOCKER env variables when defined (#36759)
* Use DOCKER_DEFAULT_IP when defined

* default localhost value overwrites DOCKER_TLS_HOSTNAME

* Backward compatibility, allow localhost as default docker_tls_hostname
2018-05-23 21:45:52 -05:00
Yunge Zhu
21ea92feca Fixes #36621, support adfs auth through adal (#37909)
* update username/password auth to use adal lib

* remove default client_id after discussion

* fix lint error: trailing whitespace
2018-05-23 16:37:44 -07:00
Matt Clay
8deced3e04
Fix shebangs and file modes and update tests. (#40563)
* Add execute bit sanity test and apply fixes.
* Add shebang test for `lib` dirs and apply fixes.
* Shebang and execute bit cleanup.
2018-05-22 14:25:36 -07:00
Jon Dufresne
1d640182c6 Update all pypi.python.org URLs to pypi.org (#38988)
For details on the new PyPI, see the blog post:

https://pythoninsider.blogspot.ca/2018/04/new-pypi-launched-legacy-pypi-shutting.html
2018-05-14 17:41:47 -05:00
Peter Farmer
16994bbdca cloudstack: use paging for listVirtualMachines (#40018)
Paging wasn't implemented, so once a cs domain has over 500 (default page size) VMs, Ansible can no longer find newly created VM.
2018-05-12 09:46:49 +02:00
John Roach
22456a57de Adding multiple project support for GCE (#39473)
* Adding multiple project support for GCP inventory.

* Adding some documentation on the .ini file
2018-05-11 11:38:13 -04:00
Yuwei Zhou
127cfd4851 add user-agent to Azure API calls, and support MSI/CLI cred for inventory (#39785)
* add user agent

* add msi

* support cli

* check subscription

* lint

* fix lint

* fix lint

* fix lint
2018-05-11 15:13:39 +08:00
Abhijeet Kasurde
5ed81820c0
VMware: Custom Field in vmware_inventory (#39796)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-05-10 17:38:03 +05:30
Daryl Banttari
e0893aacc5 [ec2 contrib script] Add ability to filter EC2 instances via shell environment (#39034) 2018-05-02 23:44:36 -04:00
Sylvain Rabot
521cc3d4e6 [contrib] azure_rm.py add mechanism to force use of private ip as ansible_host (#36109)
Signed-off-by: Sylvain Rabot <s.rabot@lectra.com>
2018-05-02 17:38:06 -07:00
Ondra Machacek
fac7b2f1ca ovirt: Clarify secrets configuration (#39501)
Fixes: https://github.com/ansible/ansible/issues/39478
2018-05-01 14:10:58 -05:00
Matt Clay
32d786af65 Convert more http links to https. 2018-04-25 23:12:46 -07:00
Javier Beaumont
8faf9837d0 [cloud][aws] PEP8 renaming in EC2 dynamic inventory (#39164) 2018-04-23 11:12:25 -04:00
Abhijeet Kasurde
12431d23cd VMware: Support for multiple jinja filters in vmware_inventory (#38173)
This fix adds support for multiple jinja filters for groupby_patterns
and host_filters.

Fixes: #37961

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-04-11 15:50:35 -04:00
John Roach
3f2c90914e Fixes Making sure that the key value returns a string to avoid concatenation issues (#37445) 2018-04-05 11:47:55 -04:00
Bill Nottingham
15b6ec66bb Set raw=True when reading passwords from ConfigParser files. (#35582)
* Set `raw=True` when reading passwords from ConfigParser files.

The assumption is that no one is actually doing interpolation on the
password value, even if they may for other configuration values, and
passwords are far more likely to contain '%'.

* Add vmware_inventory as well.
2018-04-05 09:25:11 -04:00
Hideki Saito
1b121fc9e4 Fix dynamic inventory for vagrant does not work on python3 (#37631)
* Fix dynamic inventory for vagrant does not work on python3 #35129
2018-03-22 15:13:43 -07:00
Patrick Marques
d5cd10c214 Remove unused import from azure dyn inventory (#34980) 2018-03-22 10:57:45 +10:00
Jordan Borean
89a80e0591
Removed windows_azure inventory script to avoid confusion with azure_rm.py (#37439) 2018-03-22 09:29:08 +10:00
Tyler Gregory
6dfc82fe3e Set win_rm protocol to the name, not the full ProtocolTypes object (#37499) 2018-03-21 15:37:48 +10:00
Peter Schiffer
8c992ccbc7 Allow filtering of instances by tags in GCE dynamic inventory (#35770)
* Allow filtering of instances by tags in GCE dynamic inventory

* Optimize instance tags configuration

* Fix for PEP8
2018-03-14 14:09:06 -04:00
Pilou
1c43f7c482 FreeIPA inventory (ipalib 4.6.2): avoid exception (#34356)
Workaround for https://pagure.io/freeipa/issue/7345.

mentions:
- IPA_CONFDIR environment variable when directory doesn't exist
- domain, xmlrpc_uri or jsonrpc_uri parameters when one is missing

Exception was:
$ IPA_CONFDIR=/path/to/empty/dir ./ansible/contrib/inventory/freeipa.py --list
Traceback (most recent call last):
  File "./ansible/contrib/inventory/freeipa.py", line 95, in <module>
    api = initialize()
  File "./ansible/contrib/inventory/freeipa.py", line 18, in initialize
    api.finalize()
  File "local/lib/python2.7/site-packages/ipalib/plugable.py", line 738, in finalize
    self.__do_if_not_done('load_plugins')
  File "local/lib/python2.7/site-packages/ipalib/plugable.py", line 425, in __do_if_not_done
    getattr(self, name)()
  File "local/lib/python2.7/site-packages/ipalib/plugable.py", line 618, in load_plugins
    for package in self.packages:
  File "local/lib/python2.7/site-packages/ipalib/__init__.py", line 949, in packages
    ipaclient.remote_plugins.get_package(self),
  File "local/lib/python2.7/site-packages/ipaclient/remote_plugins/__init__.py", line 120, in get_package
    server_info = ServerInfo(api)
  File "local/lib/python2.7/site-packages/ipaclient/remote_plugins/__init__.py", line 26, in __init__
    hostname = DNSName(api.env.server).ToASCII()
AttributeError: 'Env' object has no attribute 'server'
2018-02-26 05:07:51 -05:00
Monty Taylor
0f893027c4 Add a module_utils OpenStack Cloud constructor (#20974)
Start using this to construct shade OpenStack Cloud objects in a
consistent manner. This will let us centralize things like dealing with
password arguments and whatnot. It also allows us to introduce the
ability to pass a fully formed config dict directly to the module.

Migrate all OpenStack modules to use openstack_cloud_from_module.

Have it return the shade library since it's responsible for
importing shade and shade is needed for the exceptions.

Only pull specific OpenStack arguments for the constructor

Rather than passing **module.params to the shade constructor, pull out
only the values that make sense. This should prevent the issues with
module parameters stepping on shade parameters.

Replace module.params.pop with module.params.get

We don't need to pop these anymore since the shade constructor is now
using opt-in values.

Using real urls is ungood. Use example.com domains. Also, get rid of the
antiquated port numbers.
2018-02-15 15:20:49 +01:00
ABond
2940b9d5bb Removed sort from json dump since response is a mix of strings and integers (#34217) 2018-02-10 07:52:10 +05:30
Simon Wydooghe
c119f6e642 Add 'digital_ocean' as group (#21631) 2018-02-10 07:48:03 +05:30
Paul B
ccdc93ab59 contrib(inventory): fix Scaleway inventory used w/env variable token (#35701)
In order to authenticate with the Scaleway API for the contrib dynamic
inventory Scaleway the environment variable SCALEWAY_TOKEN was read
only if a value was set in the configuration .ini file.

This PR fixes that allowing to read only the environment variable
without needing to set a token in the configuration file.

Closes #35693
2018-02-05 08:32:49 +00:00
Richard Bywater
7dbcf752c8 Add ability to select to prefer IPv4 addresses for ansible_ssh_host (#35584)
Currently Cloudforms can return a mix of IPv4 and IPv6 addresses in the
ipaddresses field and this mix comes in a "random" order (that is the
first entry may be IPv4 sometimes but IPv6 other times). If you wish to
always use IPv4 for the ansible_ssh_host value then this is problematic.

This change adds a new prefer_ipv4 flag which will look for the first
IPv4 address in the ipaddresses list and uses that instead of just the
first entry.
2018-02-01 10:33:51 -05:00
Clement Trebuchet
862c439223 Contrib infoblox exattrs Fixes #35409 (#35410)
* *FIX: re-create the exattrs dict into the hostvars[name] dict

* *FIX: remove unwanted files

* Fixes #35409: put an str instead of variable
2018-01-31 09:17:34 -05:00
Peter Sprygada
c2d3b9cbd5
refactors nios api shared code to handle provider better (#35393)
* refactors nios api shared code to handle provider better

This change refactors the shared code to be easily shared between
modules, plugins and dynamic inventory scripts.  All parts now implement
the provider arguments uniformly.

This also provides a centralized fix to suppress urllib3 warnings coming
from the requests library implemented by infoblox_client

* fix up pep8 errors

* fix missing var name
2018-01-27 08:03:06 -05:00
Peter Sprygada
3f556f2e37
adds infoblox dynamic inventory script (#35328)
* adds infoblox dynamic inventory script

* fix up issues from sanity testing

* fix pep8 issues
2018-01-25 14:29:11 -05:00
Jonathan McCall
cdf8f29e70 Add hash making inventory caches unique to inventory script ran (#34742) 2018-01-23 13:10:22 -05:00
Sam Edwards
a1639abd71 Fix Digital Ocean inventory script pagination handling (#35153) 2018-01-23 19:29:50 +05:30
Kristóf Havasi
1c22d82c5e consul_io: fixed service availability check (#34293)
service is only up if the node publishing it is also available
2018-01-19 16:33:52 -05:00
Fabrice Flore-Thébault
5b52bfad6d azure_rm inventory should add "ansible_connection: winrm" in host_vars for windows hosts - fixes #34689 (#34691)
* fix for https://github.com/ansible/ansible/issues/34689
azure_rm inventory should add "ansible_connection: winrm" in host_vars for windows hosts

* add ansible_connection: winrm - fix for https://github.com/ansible/ansible/issues/34689
2018-01-18 05:49:50 +10:00
Richard Bywater
a7e27b74c9 Add ability to append suffix to host names for Cloudforms Inventory (#33565)
* Add ability to append suffix to host names for Cloudforms Inventory

Allows for use of a suffix that will be appended to host names returned
from Cloudforms API if that suffix is not present.

For example with a suffix of 'example.org', the following results
would be shown for a particular Cloudforms host name:
someexample -> someexample.example.org
someexample.example.org -> someexample.example.org

The main use-case for this is when Cloudforms has short names rather
than FQDN and there is a desire to to use the FQDN as the name.

* Add example line into Cloudforms INI file

* Clarify that leading fullstop needed

* Add validation to ensure leading fullstop for suffix
2018-01-17 06:36:17 -08:00
Abhijeet Kasurde
191b934dbd
freeipa: support for host vars (#34535)
Adds method to return host vars related to FreeIPA hostname.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-01-15 13:57:30 +05:30
Danilo Riecken P. de Morais
5540e2f8a9 cloudstack: inventory: Added feature list by tag (#31319) 2018-01-14 20:42:31 +01:00
Paul B
9302e8d2a4 contrib(inventory): adds a dynamic inventory for Scaleway cloud (#30313)
provider

Provides a dynamic inventory plugin for Scaleway cloud provider with
the following features:

- Configurable scaleway.ini file
- Cache API responses
- Choose public or private IPs
- Create groups per Scaleway 'tags'
- Create groups per Scaleway regions
2018-01-13 14:55:05 +00:00
Matt Clay
797664d9cb Python 2.6 str.format() compatibility fixes. 2018-01-10 14:08:11 -08:00
Fedele Mantuano
70fd5d4caf More stable explicit file close. (#34303) 2018-01-02 10:03:44 -06:00
Abhijeet Kasurde
0eb2644c1c Fix redeclaration of get_host_info function (#33608)
This fix redeclaration of get_host_info method in linode
inventory.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-01-02 10:24:53 -05:00
Kristóf Havasi
a05ed65295 consul_io.py: typo fixed in docs (#34292) 2017-12-30 03:08:28 +01:00
Kristóf Havasi
6ba6c7e67c contrib/inventory/consul_io: typo fixed in documentation (#34291) 2017-12-29 16:49:37 +05:30
Robert "Bo" Davis
b5c0141fb0 Use hostname in group_by_aws_account to prevent duplicates. (#34053)
Fix typo. The use of `dest` for group_by_aws_account causes the group to be produced using IP and to duplicate the hosts in the inventory.

Fixes #23772

Signed-off-by: bo <robert@jbanetwork.com>
2017-12-19 17:04:46 -05:00
Ryan Groten
b34d150bec Use hostgroup_find(all=True) returns member hosts of all hostgroups in a single call (#29106) 2017-12-18 12:28:19 -05:00
Abhijeet Kasurde
36f82ae8cc Replace exit() with sys.exit()
This fix adds replacement for exit() to sys.exit(), as
exit() is not recommended way to exit from the program.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-12-14 22:03:08 -05:00
Giovanni Sciortino
ff923fb6b0 Add scan_new_hosts feature in ansible foreman inventory (#33743) 2017-12-14 15:10:42 -05:00
pymag09
92c5b758f8 Improve consul_io.py execution speed (#33737)
* Improve execution speed

* fix missing whitespace
2017-12-13 13:33:28 +00:00
Abhijeet Kasurde
ebd6db7a1c
Digital Ocean Inventory refactor (#29176)
* Remove 'dopy' dependency
* Update documentation
* Incorporate BondAnthony's IP address related code
* Incorporate andrewsomething's Pagination code
* Add Tags support

Fixes: #15752

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-12-09 11:27:18 +05:30
Ryan MacLean
d7ca068c3f [cloud] Typo fixes for ec2 dynamic inventory (#32957) 2017-11-30 09:58:30 -05:00
Abhijeet Kasurde
449a0f33e1
Fix ConfigParser.set error in vmware_inventory (#31643)
Fix adds default 'vmware' section in configuration,
when this section is not found.

Fixes: #31549

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-11-28 22:52:59 +05:30
Matt Clay
e45c763b64 Fix invalid string escape sequences. 2017-11-21 10:03:34 -08:00
Abhijeet Kasurde
d372cea2f8
VMware: change default host_filter to gueststate (#32839)
This fix changes default value of host_filter in vmware_inventory.py
and vmware_inventory.ini to 'runtime.powerstate' from 'guest.gueststate'.
This change is added as 'guest.gueststate' requires vmware tools to be
installed on given VM, which may not be the case everytime.

Fixes: #25086

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-11-21 04:32:18 +00:00
gamuniz
10866bfb8b Exception handling in vmware_inventory for vcsim (#32700)
* vmware_inventory changes to support vcsim
* updated debug message per maintainer request
2017-11-12 21:29:25 -05:00
Kenny Woodson
c4af03118b Add support for tags and instance attributes for destination variable for the ec2 dynamic inventory. (#29033) 2017-10-24 16:09:59 -04:00
Ondra Machacek
a7df2322e4 ovirt: Add env variables to dynamic inventory (#31821)
This patch add new environment variables to oVirt dynamic inventory
to be consistent with all other oVirt modules:

 OVIRT_URL
 OVIRT_USERNAME
 OVIRT_CAFILE
 OVIRT_PASSWORD

Those variables are used as fallback if user don't specify a ini file,
with appropriate variables there.
2017-10-18 11:26:03 +01:00
Adrian Likins
297dfb1d50 Vault secrets script client inc new 'keyring' client (#27669)
This adds a new type of vault-password script  (a 'client') that takes advantage of and enhances the 
multiple vault password support.

If a vault password script basename ends with the name '-client', consider it a vault password script client. 

A vault password script 'client' just means that the script will take a '--vault-id' command line arg.

The previous vault password script (as invoked by --vault-password-file pointing to an executable) takes
no args and returns the password on stdout. But it doesnt know anything about --vault-id or multiple vault
passwords.

The new 'protocol' of the vault password script takes a cli arg ('--vault-id') so that it can lookup that specific
vault-id and return it's password.

Since existing vault password scripts don't know the new 'protocol', a way to distinguish password scripts
that do understand the protocol was needed.  The convention now is to consider password scripts that are
named like 'something-client.py' (and executable) to be vault password client scripts.

The new client scripts get invoked with the '--vault-id' they were requested for. An example:

     ansible-playbook --vault-id my_vault_id@contrib/vault/vault-keyring-client.py some_playbook.yml

That will cause the 'contrib/vault/vault-keyring-client.py' script to be invoked as:

     contrib/vault/vault-keyring-client.py --vault-id my_vault_id

The previous vault-keyring.py password script was extended to become vault-keyring-client.py. It uses
the python 'keyring' module to request secrets from various backends. The plain 'vault-keyring.py' script
would determine which key id and keyring name to use based on values that had to be set in ansible.cfg.
So it was also limited to one keyring name.

The new vault-keyring-client.py will request the secret for the vault id provided via the '--vault-id' option.
The script can be used without config and can be used for multiple keyring ids (and keyrings).

On success, a vault password client script will print the password to stdout and exit with a return code of 0.
If the 'client' script can't find a secret for the --vault-id, the script will exit with return code of 2 and print an error to stderr.
2017-10-13 15:23:08 -04:00
Matt Martz
e2f16cfaf7 Port vault-keyring.py to properly load the config. Fixes #31304 (#31315) 2017-10-13 13:46:24 -04:00
François Scala
aade5234a9 Fix urlparse import for Python3 (#31240)
* Fix urlparse import for Python3 in

* contrib/inventory/consul_io.py
* contrib/inventory/rudder.py
* contrib/inventory/windows_azure.py
* lib/ansible/module_utils/known_hosts.py
* lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py
* lib/ansible/modules/cloud/docker/_docker.py
* lib/ansible/modules/cloud/ovirt/ovirt_disk.py
* lib/ansible/plugins/action/ce_template.py
2017-10-09 20:18:09 -07:00
Thomas Stringer
cb01f33d1e refactor azure dynamic inventory script configparser import to support python3 (#31370)
* refactor configparser import to support python3

* change ModuleNotFoundError to ImportError
2017-10-05 11:49:35 -07:00
Avner Cohen
d313c2d5e9 [cloud] RDS config should be getboolean, as per ec2.ini instructions (#31168) 2017-10-02 15:08:31 -04:00
Jiri Tyr
d35ef1fc21 [cloud][contrib] Set missing default values for EC2 inventory (#28375)
* Set missing default values for EC2 inventory

* Make it run even with no ec2.ini file

* Fixing INI file reading

* Refactor how defaults are handeled

Define defaults in a dictionary and use .get rather than if statements with has_option

* Removing double keys and fixing logic for instance_filter

* Removing one more doubled key
2017-09-29 10:48:48 -04:00
jctanner
219a6a67f1 Add a select_chain_match filter to vmware_inventory (#28778) 2017-09-27 19:06:01 -04:00
Martin Krizek
d804ac6f4b Implement AND'd filters in ec2.py/ini (#30272)
* Implement AND'd filters in ec2.py/ini

remove debug print

* Adjusting code to changed filters' data structure
2017-09-21 12:06:56 -04:00
Matt Clay
7714dcd04e Enable more pylint rules and fix reported issues. (#30539)
* Enable pylint unreachable test.
* Enable pylint suppressed-message test.
* Enable pylint redundant-unittest-assert test.
* Enable pylint bad-open-mode test.
* Enable pylint signature-differs test.
* Enable pylint unnecessary-pass test.
* Enable pylint unnecessary-lambda test.
* Enable pylint raising-bad-type test.
* Enable pylint logging-not-lazy test.
* Enable pylint logging-format-interpolation test.
* Enable pylint useless-else-on-loop test.
2017-09-18 23:20:32 -07:00
jchristi
9d5671db76 Allow filtering RDS instances by tags in the ec2 dynamic inventory script (#24423)
* Allow filtering RDS instances by tags in the ec2.py dynamic inventory script

* PEP8 fix

* Fix no-bastring code smell

* Simplify logic in ec2.py RDS filtering by tag
2017-09-14 10:58:16 -04:00
Matt Clay
442af3744e Miscellaneous pylint fixes.
The following rules are no longer disabled:

- bad-format-string
- duplicate-key
- lost-exception
- trailing-newlines
- unexpected-keyword-arg
- useless-suppression
- using-constant-test
2017-09-13 01:53:08 -07:00
Matt Clay
68aeaa58a8 Fix dangerous default args. (#29839) 2017-09-12 00:11:13 -07:00
Will Thames
f9a179f770 Handle missing docker-py better (#27540)
* Update docker inventory to use APIClient

docker-py has been updated, and the `Client` class no longer
exists. We use the new `APIClient` class.

To provide graceful failure when docker-py is not installed,
we need to create a dummy `Client` class so that the inventory
script will get as far as displaying a useful error message

Before

```
$ contrib/inventory/docker.py --pretty
Traceback (most recent call last):
  File "contrib/inventory/docker.py", line 418, in <module>
    class AnsibleDockerClient(Client):
NameError: name 'Client' is not defined
```

After

```
$ contrib/inventory/docker.py --pretty
Failed to import docker-py. Try `pip install docker-py` - cannot import name Client
```

* docker inventory configuration file location

Allow docker.yml to live next to docker.py, as well as in the
current directory
2017-09-10 19:06:57 -07:00
Matt Davis
12700f61e7 fixed incorrect endpoint selection in azure_rm.py 2017-09-01 11:49:56 -07:00
Maciej Lasyk
5c0b94217e Added handling optional GCE_CREDENTIALS_FILE_PATH (#25526)
Ansible documentation states that env variable based authentication bases on variable GCE_CREDENTIALS_FILE_PATH while gce.py reads only GCE_PEM_FILE_PATH (see https://docs.ansible.com/ansible/guide_gce.html). This commit adds GCE_CREDENTIALS_FILE_PATH to the configuration chain; if set it will be used.
2017-08-30 14:46:45 -04:00
Matt Davis
b3f2d1befe expose cloud_environment override in azure_rm modules (#28743)
* Can be set via env, credential profile, or module arg
* Valid values defined by Azure Python SDK, currently `AzureCloud`,`AzureChinaCloud`,`AzureUSGovernment`,`AzureGermanCloud` or any Azure Stack metadata discovery URL.
2017-08-29 13:35:24 -04:00
Alejandro Bednarik
9aa5e0cc3e Add GPL License header to freeipa inventory file. (#24353)
* Add GPl License header to freeipa incentory file.

* Short GPL license
2017-08-29 11:38:33 -04:00
furhouse
af9396841e zabbix_inventory PEP8 compliance. (#28680) 2017-08-28 20:12:32 +02:00
jctanner
443b25d72a Fixup the property collection for dictionaries vs. objects (#28609)
* Fixup the property collection for dictionaries vs. objects

* Remove debug lines

* Do not attempt to sort because it's a waste

* Remove unused code

* Remove extra code

* Capture lowercase keys
2017-08-25 09:53:01 -04:00
jctanner
65feaa11b2 Fix valueerror in vmware_inventory.py (#28597) 2017-08-24 10:04:52 -04:00
David Kretch
beed59f303 Fix trailing space in ec2_vol example, fix 'the the' typos (#28440)
* Fix 'the the' typos, fix 'pahting' filename typo

* Change 'the the' typos to a single 'the'.
* Change `playbook_pahting.rst` to `playbook_pathing.rst`.

* Delete trailing space in ec2_vol example

Delete the trailing space in `instance: "{{ item.id }} "`, which makes the
example fail when run because it looks for instance "i-xxxx ".
2017-08-19 23:00:51 +02:00
Abhijeet Kasurde
c876f4f3cf Make FreeIPA inventory work (#25354)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-08-18 15:46:43 -04:00
Andrea Tartaglia
fd01a9bb99 Added GPL header to vmware_inventory.py (#24443) 2017-08-18 15:23:45 -04:00
Michael Overmeyer
930d5d88b7 Fix #24546 (#24562) 2017-08-18 15:16:06 -04:00
Sam Doran
f35975f114 PEP8 fixes 2017-08-18 01:10:25 -04:00