Commit graph

339 commits

Author SHA1 Message Date
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
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
Peter Hoffmann
6c9cb05cfd Use tenant in UserPassCredentials if set.
If you have multiple Tenants you need to set the tenant in https://github.com/Azure/msrestazure-for-python/blob/master/msrestazure/azure_active_directory.py otherwise the azure_rm.py call will fail.
2017-08-18 01:10:25 -04:00
Achraf Cherti
e45d5b7e8e Compatibility of gce.py (Google Cloud Ansible inventory) with Python 3 (#26032)
* Compatibility of gce.py (inventory) with Python 3

* Revert './secrets.py' file check (will import 'secrets' from PYTHONPATH)

Instead of checking if secrets.py exists in the current directory, this
commit will make gce import 'secrets' from one of PYTHONPATH's paths.

There are 2 possibilities:
1. secrets.py will be used if secrets.GCE_PARAMS and
secrets.GCE_KEYWORD_PARAMS are declared.

2. secrets.py will be ignored if secrets.GCE_PARAMS and
secrets.GCE_KEYWORD_PARAMS aren't declared. This could happen in Python
>=3.6 where a module named 'secrets' could be imported if a custom
secrets.py doesn't exist in PYTHONPATH.
Check out https://www.python.org/dev/peps/pep-0506/ and
https://docs.python.org/3/library/secrets.html for more information.
2017-08-18 00:27:03 -04:00
James Portman
950e4b6505 Added checks for machine.os_profile is not None before trying to access child attributes (#22906) 2017-08-15 10:59:41 -07:00
Alvaro Aleman
bb9c6694a7 Allow the Openstack dynamic inventory to discover ansible_user (#17944) 2017-08-11 18:00:59 +02:00
Gerard Lynch
d9d983160d support OS_CLOUD in openstack dynamic inventory
allow a user to limit to a single cloud in clouds.yaml, and support
per-cloud caching.
2017-08-10 12:43:16 -07:00
Alvaro Aleman
fe5e1a4bc4 OS dynamic inventory: respect OS_CLOUD env var 2017-08-10 12:43:16 -07:00
Do Hoang Khiem
3b12a85750 Add node private & public ips to gce groups (#12539) 2017-08-09 12:45:00 -06:00
Sebastian Cruz
223f94ec56 Fix missing option in #27848 (#27892) 2017-08-09 08:41:12 -04:00
Sebastian Cruz
ce5e4dfc38 Add option to group ec2 instances by platform. (#27848)
All credits to https://github.com/felipecvo

See PR: https://github.com/ansible/ansible/pull/14246
2017-08-07 12:45:04 -06:00
Eric L
1fe14da226 Add possibility to interpret global parameters value as JSON with rich_params flag (#26180) 2017-08-07 12:41:41 -06:00
Adam Johnson
3f85aa3abd Use a real list comprehension rather than list() around a generator (#25594)
It's faster and more idiomatic.
2017-08-07 12:30:01 -06:00
Tian You
9364fa202f [cloud] Group RDS instances by tag keys in ec2 dynamic inventory (#24763) 2017-08-04 14:38:04 -04:00
jctanner
3b20585ada Fix 23417 (#27770)
* Expose user_metadat to ansible

* Fixed exception when no userData
2017-08-04 13:28:40 -04:00
Will Weber
bfbdb3f3f0 assumption made that dopy only dep in dopy (#27536) 2017-08-03 13:44:07 -07:00
Nick Ball
edf31f56af Linode inventory improvements: Add _meta/hostvars to inventory output. Add a 'linode' host group with all the hosts (#19329) 2017-08-02 13:26:30 -04:00
Toshio Kuratomi
225fa5d092 Fix undefined variables, basestring usage, and some associated python3 issues 2017-07-25 15:58:23 -07:00
Toshio Kuratomi
edccfd5908 Fix undefined variable in libcloud dyn inv script
References #27193
2017-07-23 12:01:57 -07:00
Greg Dahlman
1d8854b045 Python 3 fix for consul_io inventory (#26510)
* Python 3 fix for consul_io inventory

* Remove configparser CamelCase try statement

* revert to python2.6 compatible try;except

* Fix pip8 error E302
2017-07-20 10:35:17 -07:00
Tomáš Karásek
a5c41dcd49 Add grouping by hostname for the Packet inventory (#21069)
* Add grouping by hostname for the Packet inventory

* remove space after eol
2017-07-18 09:31:42 -04:00
Abhijeet Kasurde
f7c8e7bdab Update vmware_inventory (#26308)
Fix adds
* Exception handling
* Unit tests

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-07-18 07:20:23 -04:00