Commit Graph

43 Commits

Author SHA1 Message Date
Kevin Carter abc807a70a
Add option to enable / disable the template engine
This change allows a deployer to selectively enable or disable the
template engine. This will allow folks to override the contents of
a configuration file via the `config_overrides` option but not render
any jinja related content within the file, except for what is provided
by the `config_overrides` option.

Change-Id: If226b4814a88b3bd7968b5e2ef64474710665ae0
Signed-off-by: Kevin Carter <kecarter@redhat.com>
2019-12-17 15:51:15 -06:00
Kevin Carter 73aa099f0a Add option to use a remote source
The config template action plugin assumes that the local node is
supplying a configuration file that will be used to copy content
to a target node. This change gives the module the ability to
change configuration files on target nodes using all remote
sources. The new boolean option, `remote_src` has been added to
enable or disable this functionality. When enabled, the module
will retrieve content from the target node and load it as
"user_content". By pre-loading it in the user content the
module will function normally without any major structural
changes or performance impact.

Change-Id: Id9c7e16fb935c2da0b32b7cf53449f68bd1e9c89
Signed-off-by: Kevin Carter <kecarter@redhat.com>
2019-07-09 16:19:08 +00:00
Andy McCrae 75cb8670fb Allow default section in ini to be specified
The default section in an ini file will always be 'DEFAULT', but for some
configuration files you may want to be able to set this to ensure
another section is at the top. 'global' for example, when working with
fio.

This PR adds the ability to set the section to be at the top, but will
default to 'DEFAULT' so no change will happen to existing tasks running
config_template.

Change-Id: Ifbc0b91aef46f3c2d98e73fdc9ab888244550bab
2018-05-09 12:57:33 +01:00
Jean-Philippe Evrard 708d867a70 Cleanup config_template repo
To upstream config_template as a separate plugin, we need to
cleanup the openstack-ansible-plugisn repo. This way it can
be included as standalone.
2018-02-26 14:42:49 +00:00
Michael Rice 8ead9b2685 Add missing domain parameter to _get_group_roles
Adds missing 'domain' parameter to function which
was causing errors when using keystone federation.

Change-Id: Icfc06feae806a9faf8f4d12bf2281dd6c9772989
Closes-Bug: 1733108
Signed-off-by: Michael Rice <michael@michaelrice.org>
2017-11-20 12:09:26 +00:00
Kevin Carter 2d1dd94264
remove the use of iteritems
iteritems is a py2 callable and will break when using py3.

Change-Id: Icea444baea8f3597cb8dd24e3d61e9ed0926cdf5
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2017-08-02 15:04:48 -05:00
Miguel Alex Cantu 76d5f02a32 Add ignore_none_type to config template
It is sometimes useful to tell ConfigTemplateParser to write
out options that are valueless and not suffixed with '=' or ':',
such as when overriding a my.cnf.

This commit adds the 'ignore_none_type' attribute to the config_template
module. If this attribute is set to false, then valueless options will be
written out to the resultant INI file as-is, without the '=' or ':' suffix.

Change-Id: I5c88b2019c01b44193a5d0df9299ecce6de52f01
Partial-Bug: #1693234
2017-06-26 19:12:43 +00:00
Jimmy McCrory a5d669f0b4 Remove neutron library
As of Ansible 2.3, the os_network module now allows more additional
options for 'provider_network_type'[0]. Use of OSA's neutron plugin can
be removed.

[0] https://github.com/ansible/ansible-modules-core/issues/5589

Change-Id: If74185ecca1ea639c2e1526b5542e89dd533084b
Implements: blueprint use-std-ansible-modules
2017-05-24 23:00:42 +00:00
ArchiFleKs fa85b97313 Support Keystone versionless endpoints
Uses keystone.client instead of keystone.client.v3 with session and auth
to return a keystone client with the discovered URL.

Also sets project_domain_name and user_domain_name do "Default" as they
are expected by Keystone.

Change-Id: I8fce922e2907584138a132f37887f227eabe9abe
Partial-Bug: #1688320
2017-05-11 12:21:20 -04:00
Jimmy McCrory 5e1828ce6e Don't log password arguments of keystone module
Set no_log=True for the 'login_password' and 'password' arguments of the
keystone module so that they will not be printed in plain text within
Ansible run output.

Change-Id: I07748e9ff1c1459f0eacf1409bef4e158c9e6446
2017-04-05 07:22:42 -07:00
Jenkins 7d6f37857c Merge "Always update existing matching endpoints" 2017-03-14 12:42:19 +00:00
Andy McCrae 5822e29d41 Always update existing matching endpoints
There is no usecase for having 2 endpoints that have the same Region,
interface, service_name and service_type.

The keystone module should default to update these endpoints if the url
is different, but the Region, interface, service_name and service_type
match.

This will make the default behaviour of state "present" to match that of
state "update".

Change-Id: I0ade538e20f2a926b33c1637446c2d4f650cd13d
2017-03-14 11:10:17 +00:00
Logan V cc7c9249d4 Allow keystone module to ignore service catalog
When bootstrapping Keystone it is sometimes useful to ignore the
service catalog and contact a specific Keystone instance.

Change-Id: I6ecfc422b0e8a7a5fadea08389c1268009ac7f2a
2017-02-25 21:28:44 -06:00
Jimmy McCrory 14d2727c04 Remove quotes when assigning values from an openrc
The magnum and neutron modules parse an openrc file and create key-value
pairs by literally assigning the key to anything in front of an '=' and
the value to everything after an '='. If the value is surrounded by
quotes, do not include them.

Depends-On: I4b1e7b5cb83061ea35108db545fdfa33cef037a5
Change-Id: Ib44d9fa63332286fe4e51bd818f80b5989815988
2017-02-14 16:19:41 -08:00
Bjoern Teipel ab176bbe0d Implementation Neutron SR-IOV
This change adds the new attribute
``sriov_host_interface`` in order to map ml2 network
names to physical SR-IOV capable network interfaces.

Co-Authored-By: James Denton <james.denton@rackspace.com>

Change-Id: Ia62725e2369f75000157e0ab2c3f858e61fef10d
Closes-Bug: #1653283
2017-01-09 11:12:05 -06:00
Logan V 800ef36999 Revert "Remove neutron library"
Using the upstream library breaks the ability to test network plugins
that use 'local' neutron networks (ie. calico).

https://github.com/ansible/ansible-modules-core/issues/5589

This reverts commit 38b899b63b.

Change-Id: I8a33db524c24324dc2af8463a43cb145f7cc34d6
2016-11-12 17:12:48 -06:00
Jimmy McCrory 0af898835a Remove glance library
With the use of this library replaced by upstream Ansible modules it's
no longer necessary to carry it.

Closes-Bug: 1538642

Change-Id: I55591132180eec99ce9b9bc38caa996b01d18949
Depends-On: Ic98613c37069ccb2ec1bc9a7644c922cc5b37e22
Depends-On: I017303e9a731ebc60315ea1784ba184a8294b08e
Depends-On: If0e36c61307056c8786c67b60fd56b03f2ad7bda
2016-11-11 09:19:45 -08:00
Jimmy McCrory 38b899b63b Remove neutron library
With the use of this library replaced by upstream Ansible modules it's
no longer necessary to carry it.

Change-Id: Iedc9c18a457eb2b620538c693337860b80a85123
Depends-On: I8c165531407c6b6aa8e5910cb28ae610b53e2ee5
2016-11-04 10:45:56 -07:00
Jenkins a90b10572e Merge "Remove xrange for run both Python 2 and Python 3" 2016-10-12 18:24:40 +00:00
Andy McCrae 6b5a7d942d Add get_networks command to neutron library
get_networks will return network information, and will fail if the
specified "net_name" network is not present.
If no "net_name" is specified the network information will be
returned without performing the check on the existence of "net_name"
network within neutron.

Change-Id: I01775c9b29e312cc6696ffdc708befc46d11bf52
2016-10-12 13:28:09 +00:00
Luong Anh Tuan 831103935b Remove xrange for run both Python 2 and Python 3
In python 3, range() does what xrange() used to do and xrange() does not
exist. If you want to write code that will run on both Python 2 and
Python 3, you can't use xrange().

range() can actually be faster in some cases - eg. if iterating over the
same sequence multiple times. xrange() has to reconstruct the integer
object every time, but range() will have real integer objects.
(It will always perform worse in terms of memory however)

xrange() isn't usable in all cases where a real list is needed.
For instance, it doesn't support slices, or any list methods.

Change-Id: I033289359882c08185d59d13fa0b994c4566185a
2016-10-12 12:39:30 +07:00
Jenkins 334604c209 Merge "Adding Magnum plugin" 2016-10-03 16:54:10 +00:00
Chris Hultin 18bbe27c1a Adding Magnum plugin
Adding Magnum plugin with support for creating, updating,
and deleting Cluster Templates

Change-Id: I6e158001acf9b6d6f924a5459142ee87eba09ff2
2016-09-30 10:29:08 -05:00
Gaudenz Steinlin 963d11713e Support more than one flat network
The existing logic only parsed the first flat network, but having
multiple flat networks is perfectly legal.

Change-Id: I15a17aa8f72d177c5afba3d34ee978e3fe576a67
2016-09-28 14:39:10 +02:00
Kevin Carter 80beba88da Add option to toggle list extensions
By default a list item in a JSON or YAML format will extend if a its already
defined in the target template and a config_override using a list is being set
for the existing "key".

This change allows that functionality to be toggled on or off. The boolean
option to enable list extension is ``list_extend``.

To maintain the API this feature will remain True by default.

Co-Authored-By: Travis Truman <travis_truman@cable.comcast.com>
Change-Id: I97e06aef2cc778f048f3d6863fe61d10eddb8602
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-09-09 16:15:00 -05:00
Jimmy McCrory f974f7a0cd Deserialize glance image_properties
Glance requires that the passed image properties be an iterable
dictionary.

Update the documented example to use YAML's syntax for a dictionary
instead of a JSON string. The resulting string will be deserialized
to a Python dict.

Change-Id: I2f02a4e772398d0c133d3109058d55c4f96b72f7
2016-09-06 14:02:43 -07:00
Kevin Carter c7b7169c79
Update dist-sort module for better effectiveness
The dist-sort module has been updated to ensure its execution
is effective, fast, and nonintrusive. There are cases where
the rounds made by the module take an excessive amount of time
to complete. This change ensures that the module is limiting its
rounds to a known index and the iterable is processed using a
generator.

Change-Id: I03d1f70cb6cd17f38ef37b4d8371a8982beca29e
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-07-20 08:43:01 -05:00
Jimmy McCrory 7d059fdc00 Optionally include image properties
Since glance image_properties is not a required argument, only attempt
to include it in the glance image create options when it's provided.

Change-Id: Ia4b27e1f3b433ac0efa89a1794c81f9c522093fb
2016-06-11 22:17:43 -05:00
Chris Hultin 7d534a4e8d Adding ability to set 'properties' via Glance
The 'Glance' plugin lacked the ability to set properties
on the images that were created via the plugin.  This patch
adds that ability.

Change-Id: If2c73050ed8335b3a22b79bb7ce28189de046427
2016-06-10 15:55:18 +00:00
Jimmy McCrory a72d40ef8a Provide type for boolean module parameters
Instead of inserting 'True' and 'False' into Ansible's BOOLEANS
constants, designate the parameters as a 'bool' type.
ansible.module_utils.basic will downcase and handle ensuring the
variables are cast to booleans.

Change-Id: I2fc70a90df5cca76b49fc21adee59350173157d9
2016-05-31 14:12:11 -07:00
Jenkins e8dec55732 Merge "Support users without projects in keystone library" 2016-05-18 09:06:01 +00:00
Jenkins b9c74c197b Merge "Bring delete and update functions to keystone module" 2016-05-17 22:30:22 +00:00
Jean-Philippe Evrard 58d9d83c40 Bring delete and update functions to keystone module
This commit adds "state" parameter in the keystone module for
its ensure_endpoint command.

This is the state parameter behavior:
- When not set or set to present, it will ensure the endpoint
  with the URL given will be present in keystone

- When set to update, it will ensure that the same kind of
  endpoint gets its url changed if it was different. If there
  was no endpoint of the same kind, the module will create the
  endpoint

- When set to absent, the module will delete the endpoint with
  the given url.

Closes-Bug: #1426191
Change-Id: Ie5e715d02f2d5fb96ceeb2c3e368090aa4702599
2016-05-17 19:57:13 +00:00
Jimmy McCrory 07d600dcff Support users without projects in keystone library
Update the ensure_user, ensure_user_role, and ensure_group_role commands
and dependent functions to allow creation of and role assignment to a
user without specifying a project.
This will allow use of the keystone library for creating users, such as
the heat stack admin, within only a domain.

Since a role can only get granted to either a project or domain at one
time, only attempt to grant the role within the project if both are
provided.

Notifications of state changes for the ensure role commands have also
been fixed.

Partial-Bug: 1579612
Change-Id: I6a132e5407c9881a047037b85bd6e25b85c0d8a1
2016-05-11 19:33:39 +00:00
Jesse Pretorius (odyssey4me) f975da26ce Revert "Support users without projects in keystone library"
In the os_keystone role, the 'Ensure Keystone user to Admin role'
this patch causes 'keystoneclient.exceptions.ValidationError:
Specify either a domain or project, not both'.

This reverts commit 2e1492a127.

Change-Id: I8784d4213e297fd78477b54b21c47f4c5223bb1e
2016-05-11 13:04:39 +00:00
Jimmy McCrory 2e1492a127 Support users without projects in keystone library
Update the ensure_user and ensure_user_role commands and dependent
functions to allow creation of and role assignment to a user without
specifying a project.

This will allow use of the keystone library for creating users, such as
the heat stack admin, within only a domain.

Partial-Bug: 1579612
Change-Id: I0e4c51e772f61d4879716b7b5dbe5c8211cea901
2016-05-10 13:34:49 -07:00
Gabor Lekeny dce1b35de9 Add user and project login domains to keystone
Added login_user_domain_name and login_project_domain_name parameters to
keystone module.

Closes-Bug: #1574000

Change-Id: I29524ac9dad063c266122ecee09563531217974c
Signed-off-by: Gabor Lekeny <gabor.lekeny@ericsson.com>
2016-05-03 07:34:54 +00:00
Hugh Saunders 41778e3bf3 Fix NoneType with no subnet allocation ranges
When creating a subnet, we retrieve the allocation_ranges from the
variables dict with a default value of "". This should then be fine for
various string operations. The problems is that ansible defaults
varialbes that aren't supplied to None. This means they are present in
the variables dict so don't get the default value of "".

To fix this the code that parses allocation_ranges is wrapped in an
additional conditional.

Change-Id: Ie0310c3da050336ed9b5f5d8fc02e3a4d704491d
2016-04-08 10:58:07 +01:00
Hugh Saunders 4cd932ae7a Add allocation pool support to neutron module
This allows IP allocation to be restricted to user provided ranges
within a subnet.

This is genreally useful, but the specific impetus is to avoid IP
conflicts between instances and the hosts on the public network in an AIO.
This patch does not solve the problem but paves the way for one that will.

Change-Id: I5e57bd43a2637c5e8508a7a0f0c6a41587aba94a
Partial-Bug: #1564491
2016-04-05 06:14:04 +00:00
Jenkins 5ae38bdcd2 Merge "Fixes keystone library incompatibility with the Keystone v3 client" 2016-03-03 22:53:36 +00:00
Simental Magana, Marcos 7c08483bc2 define login_project_name key on keystone library.
When using the ansible keystone to create projects, users, or
other keystone operations by using login_user and login_password
fails asking to define login_project_name, but when login_project_name
is defined, fails with message:
"msg": "unsupported parameter for module: login_project_name"
this is because such key is not defined in the keystone library.

Change-Id: I7c6bdfd9e6ca51b4c4045204f1dd49733c949dad
Closes-Bug: 1551423
2016-02-29 15:24:04 -06:00
Travis Truman 9df1773b4e Fixes keystone library incompatibility with the Keystone v3 client
When configuring federated identity mapping for Keystone using example here:
http://docs.openstack.org/developer/openstack-ansible/install-guide/configure-federation-mapping.html

Task [os_keystone | Ensure Group/Project/Role mapping exists]
fails with:

http://paste.openstack.org/show/484433/

Change-Id: I522b6a3f5609db0f8a20157625eebd28d9e2601c
2016-02-01 09:33:31 -05:00
Kevin Carter 2c9c5f005b
first commit
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-01-25 18:07:53 -06:00