Commit graph

452 commits

Author SHA1 Message Date
Dan Nicholson
3ada56e2b1 Skip non-management Packet IP addresses (#48168)
Non-management (elastic) IP addresses require manual configuration on
the host as described in https://help.packet.net/article/54-elastic-ips.
Skip those so that only the automatically configured management
addresses are used. Otherwise, a non-routable address may be returned in
the inventory.
2018-12-20 12:06:11 +00:00
Eric Miller
4d0f2e632c Docker inventory service/stack groups for docker swarm (#48021)
* Adding service and stack grouping to docker inventory

* Updating documentation

* Adding changelog fragment for docker.py inventory script
2018-12-17 11:58:26 +00:00
Toshio Kuratomi
175f3b51e5 Ensure that current uses of BaseException are required
* In some cases, it appears that Exception should have been used instead
  as there's no need to catch sys.exit KeyboardInterrupt and similar.
* In a few cases, it appears that BaseException is used because
  a library we depend on calls sys.exit() contrary to good coding
  design.  Comment those so that we know that those have been audited
  and found to be correct and change to use (Exception, SystemExit)
  instead.
2018-12-16 15:03:19 -08:00
Toshio Kuratomi
3fba006207 Update bare exceptions to specify Exception.
This will keep us from accidentally catching program-exiting exceptions
like KeyboardInterupt and SystemExit.
2018-12-16 15:03:19 -08:00
Stef Fen
9dc36fcaf0 Fix AWS STS session detection (#49536)
If CLI has already assumed a IAM Role, then the cli environment has an additional variable: AWS_SESSION_TOKEN
This needs to be forwarded to boto to successfully reuse the AWS session in boto.
2018-12-06 09:53:53 +10:00
Pierre-Yves Ritschard
bd1050dfc7 cloudstack: inventory: consider more keys optional (#49364) 2018-12-01 02:00:41 +01:00
Filippo125
238786c0d3 zabbix inventory: options to read per each host and set ansible_ssh_host (#44107) 2018-12-01 01:49:57 +01:00
Keith Resar
43affc661b add want_ssh_ansible_host flag to foreman dynamic inventory (#34169) 2018-11-15 15:58:34 -05:00
Yunge Zhu
3793bcf481 update doc in contrib\inventory\azure_rm.py (#46939)
* add inventory note

* typo
2018-11-14 15:42:38 -08:00
Austin Hobbs
6c94c28a12 Ansible Vault and Azure Key Vault vault password script (#44544)
* added new vault password files that can be used with Azure Key Vault

* fixed pylint errors

* fixed pep 8 violations
2018-11-06 15:07:28 -05:00
milo-minderbinder
77d73808e6 fix setting config with DOCKER_CONFIG_FILE (#23096)
Fixes #23095

Fixed issue preventing a caller from setting a docker
configuration file (e.g. docker.yml) by specifing the
config file path in the `DOCKER_CONFIG_FILE` environment
variable. Previously, the cli argument parser set a default value for
the `--config-file` argument which would prevent ever checking the
environment variable, regardless of whether or not the `--config-file`
argument even specified a valid file.

This commit adds a global `DEFAULT_DOCKER_CONFIG_FILE` variable, which
points to the current default `docker.yml` config in the
contrib/inventory directory. Now, when this script is called from the
command line, the config file passed with the cli `--config-file` arg
will be given the highest precedence; if it is absent, this script will
then check if the `DOCKER_CONFIG_FILE` env var is set, and load the
config file specified if possible. If neither the environment variable
or cli argument are specified, then the script will attempt to parse the
config file `docker.yml` in this script's directory (if present).

If either the `DOCKER_CONFIG_FILE` environment variable or the
`--config-file` argument are given but point to a nonexistant file, then
the script will print an error message and exit with an error code.

It is *not* an error condition if the fallback `docker.yml` does not
exist.
2018-10-30 15:39:32 -04:00
jctanner
1ded3f9890
Handle non-ascii characters in foreman.py (#46779)
* Handle non-ascii characters in foreman.py

* Add test to validate non-ascii results
2018-10-15 21:40:51 -04:00
Matt Clay
a11f631ee4 Python 3.8 collections compatibility fixes.
Includes a new pylint blacklist plugin to prevent regressions.
2018-10-08 11:26:37 -07:00
VitSkakun
aaa3b2dc2d fix digitalocean inventory tags endpoint (#46192) 2018-10-06 22:20:11 -04:00
Abhijeet Kasurde
0ecbd50c3b Misc typo fixes (#45969)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-09-21 14:43:22 +01:00
Larry Singer
17ca0a9bd9 The keyword 'cloud' has been deprecated in favor of the 'profile' keyword by os-client-config. (#31389) 2018-09-20 11:31:19 -05:00
jamiesonio
6711c9524e Add environmental variables to allow for the script to be run without consul_io.ini. This allows it to run dynamically without any prerequisite config file (#30900) 2018-09-19 18:19:35 -04:00
Paul Czarkowski
caf658b420 Fix bugs in softlayer dynamic inventory (#28178)
* --host hostname did not work due to calling wrong function

* softlayer api returns a bunch of extra stuff in the tagReference dict that
  makes --list output crazy long, like over a terminal buffer for just one server
  this culls out the extranneous information and only inserts the actual user
  provided tags to each server.
2018-09-19 18:10:15 -04:00
ABond
65c9090714 DigitalOcean inventory deprecation warning (#45054)
Handle DeprecationWarning for ConfigParser in python3

Fixes #45053
2018-09-05 07:16:03 +05:30
Simon Wydooghe
505ce6ccf6 ec2 inventory: python 3.7 compatibility (#43716)
ec2 inventory script was throwing errors when using Python 3.7:

TypeError: option values must be strings

This changes the None ConfigParser options to empty strings instead.
2018-09-05 09:27:35 +10:00
Max Cameron
cf1006179d Fixes ec2.py assume_role. (#37357)
* Fixes ec2.py assume_role

Previously when connect_to_aws was called it updated the credentials in place.  "connect_to_aws" is called multiple times: on the second run it tries to assume the same role it is already using, and potentially failing depending on your iam policies.
2018-09-04 09:43:58 -04:00
Yves Martin
2f9a5a75a8 Update vault-keyring to ConfigManager internals (#41967)
Fix failure since ConfigManager changes
2018-08-22 13:09:22 -04:00
Miguel C
fa8154db40 Fix #43917 (#43929)
Support upper/lower case resource groups
2018-08-13 12:24:13 +08:00
Matt Martz
c1c229c6d4
Remove use of simplejson throughout code base (#43548)
* Remove use of simplejson throughout code base. Fixes #42761

* Address failing tests

* Remove simplejson from contrib and other outlying files

* Add changelog fragment for simplejson removal
2018-08-10 11:13:29 -05:00
Etienne Deneuve
379fb87b44 add group_by_os_family in azure dynamic inventory (#40702) 2018-08-09 17:00:17 +08:00
Abhijeet Kasurde
e364d717cb
VMware: remove unused imports (#43804)
Idea taken from https://github.com/ansible/ansible/pull/43402

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-08-09 10:34:55 +05:30
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