Commit graph

404 commits

Author SHA1 Message Date
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