Commit Graph

40 Commits

Author SHA1 Message Date
Guilherme Steinmüller c30e4a5a34 Retire openstack-ansible-os_zaqar
Change-Id: Id1b0aa720d293298ab48fae2e926e79fb7df4511
2019-04-17 23:43:21 +00:00
Jesse Pretorius 673dcb63a3 Enable overriding the service setup host python interpreter
In order to enable the service setup host python interpreter to
be changed easily, we make it a variable. This will be useful
when someone sets the service setup host to be the utility
container, because we'll be able to set this var by default.

Change-Id: I0c3f20032fc673a20088fb6a946c7af57d6a4841
2018-11-30 16:59:05 +00:00
ZhijunWei b4d340c857 use include_tasks instead of include
include is marked as deprecated since ansible 2.4[0]

Switch to include_tasks or import_playbook as necessary

[0] https://docs.ansible.com/ansible/2.4/include_module.html#deprecated

Change-Id: I2b89abfe09c9bd8386b83833b7f17eb388c7425f
2018-09-06 08:15:51 +08:00
Jesse Pretorius 0fc824798e Use a common python build/install role
In order to radically simplify how we prepare the service
venvs, we use a common role to do the wheel builds and the
venv preparation. This makes the process far simpler to
understand, because the role does its own building and
installing. It also reduces the code maintenance burden,
because instead of duplicating the build processes in the
repo_build role and the service role - we only have it all
done in a single place.

We also change the role venv tag var to use the integrated
build's common venv tag so that we can remove the role's
venv tag in group_vars in the integrated build. This reduces
memory consumption and also reduces the duplication.

This is by no means the final stop in the simplification
process, but it is a step forward. The will be work to follow
which:

1. Replaces 'developer mode' with an equivalent mechanism
   that uses the common role and is simpler to understand.
   We will also simplify the provisioning of pip install
   arguments when doing this.

This patch also cleans up the unnecessary tags and makes a
few changes to the role to tidy things up a bit.

Depends-On: https://review.openstack.org/598957
Change-Id: I61d005d4732bd1d6cf4125cbf1adfdb1479a4b1b
Implements: blueprint python-build-install-simplification
Signed-off-by: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
2018-09-04 13:47:41 +00:00
Jean-Philippe Evrard d25f899c43 Fix usage of "|" for tests
With the more recent versions of ansible, we should now use
"is" instead of the "|" sign for the tests.

This should fix it.

Change-Id: I7a5b4cf134a73e9dc6eda08c935696c5b8b8a034
2018-07-30 10:44:21 +02:00
Jesse Pretorius 62dfbc77bd Execute service setup against a delegated host using Ansible built-in modules
In order to reduce the packages required to pip install on to the hosts,
we allow the service setup to be delegated to a specific host, defaulting
to the deploy host. We also switch as many tasks as possible to using the
built-in Ansible modules which make use of the shade library.

The 'virtualenv' package is now installed appropriately by the openstack_hosts
role, so there's no need to install it any more. The 'httplib2' package is a
legacy Ansible requirement for the get_url/get_uri module which is no longer
needed. The keystone client library is not required any more now that we're
using the upstream modules. As there are no required packages left, the task
to install them is also removed.

With the dependent patches, the openstack_openrc role is now executed once
on the designated host, so it is no longer required as a meta-dependency for
the role.

Depends-On: https://review.openstack.org/582359
Change-Id: Ic844753c3ece4383eefa490f00be0bff441c6a7e
2018-07-13 15:36:09 +00:00
Zuul 8f6c8daee0 Merge "Only replace python when re-initializing the venv" 2018-04-24 14:20:55 +00:00
fpxie da3dd31c50 Do not log passwords
This prevents data to be leaked into the callback plugin.

Change-Id: I116950c9dd6284aade0c2e514a5717dceeb981b0
2018-04-24 08:21:19 +08:00
Jesse Pretorius da4ea69eb2 Only replace python when re-initializing the venv
We reinitialize the venv to ensure that the right version of
python is in the venv, but we do not want virtualenv to also
replace pip, setuptools and wheel so we tell it not to. If we
don't do this then virtualenv will install the latest available
version, which is not what we want.

Change-Id: I8772e90fa3ff2653836870921ee0e182150715e4
Partial-Bug: #1764470
2018-04-18 11:06:06 +01:00
Jean-Philippe Evrard 2f2aafba37 Reinitialize the virtualenv
In the previous patch removing the virtualenv-tools, we've updated
paths to the proper binaries, but we don't reset the virtualenv
like what we used to do.

Change-Id: I05e02d36bed208b44f666ddb4ace8e847c88b76a
Partial-Bug: #1741634
2018-01-19 16:55:42 +00:00
Zuul fdee86037a Merge "Replace virtualenv-tools by a script" 2018-01-16 12:54:54 +00:00
Jean-Philippe Evrard 9a293bce71 Replace virtualenv-tools by a script
virtualenv-tools has a bug which gets triggered in gates: it can't
change the shebang of a virtualenv python bin/ files if they
were generated with a virtualenv script whose shebang ends with
python2 instead of python.

Because we can't modify virtualenv-tools, we use shell scripts
instead.

Change-Id: If5d213bbe27c7f07508f4c20e7d3f5d911ba974d
Partial-Bug: #1741634
2018-01-15 14:18:59 +00:00
Zuul 834a565d40 Merge "Fix for lookup and get_url occuring in different places" 2017-12-29 08:27:58 +00:00
Andy McCrae 5a26587133 Allow the developer constraints to be adjusted
In order to do a developer mode that allows installation of packages
from local file, which take precedence over the developer_mode
constraints, we need to allow the order of the constraints to be
changed.

This patch adds a "pip_install_developer_constraints" var which is used
to set the developer mode constraints. By default this will leave the
same behaviour but will allow additional constraints to be added, or the
developermode constraints file to be overriden altogether.

Change-Id: I4022629a957a11ac90026a4df13855324db4c2a9
2017-05-26 12:04:17 +01:00
Rick Box 7103d2bc59 Fix for lookup and get_url occuring in different places
We use an SSH bastion host which we do our deployment through. The
deployment host doesn't have direct access to the same network as the
host. As a result the venv local checksum lookup fails.

I have described this here:

https://bugs.launchpad.net/openstack-ansible/+bug/1689283

This is a simple fix for this problem, assuming everything is good it
will need repeating in multiple places in the code base.

Change-Id: I5b1ac355370365a7895033e772b418b8c1db8f3f
2017-05-10 14:31:38 +01:00
Logan V 541537405d Clean up developer mode logic
Fixes the ability to deploy a venv in cases where:
1) developer_mode is not enabled
2) A cached venv is not downloaded from the repo server

Additional cleanup to the developer_mode venv deployment
logic is implemented by adding a *_venv_download var
which is used to decouple developer_mode from the
cached venv extraction process so that a deployer
can force venv builds in-place (disable cached
venv usage) without enabling developer mode
constraints.

Change-Id: Id41f3963f4be4444dca8362e6f71f537f01429f2
2017-01-13 19:52:42 -06:00
Jesse Pretorius a713e95929 Reinitialize venv upon install
Reinitializes (copies python, etc binaries) into the venv when
dropping a new venv into place. This is needed because the Python
binary packaged with the venv may not match the Python running on
the host it is being installed to. (ie. in the case of a Xenial
repo container and a Trusty target host.)

Change-Id: I4ea706ac12e37c42eec41d5d734ad95cdcef9e58
Partial-Bug: #1637509
2016-11-16 09:14:46 +00:00
Jesse Pretorius fd78cdf252 Remove join filter from pip module tasks
Ansible 2.2 now treats the 'name' argument for the pip module
as a list, removing the need for us to implement the join
filter to optimise the install execution.

Change-Id: Ifbeae6a808f6c8be34cd7bb4d3a8d8e7ba1e5c9d
2016-11-09 21:35:43 +00:00
Jesse Pretorius 038e3c1cf6 Use updated get_url module checksum functionality
Starting in Ansible 2.0, the get_url [1] module provides the
ability for a checksum to be provided to the get_url module
which will be verified against the local destination file
and the task skipped if it matches.

[1] http://docs.ansible.com/ansible/get_url_module.html

This patch implements the use of this functionality.

The ability to ignore a venv download failure is also removed
as this is not necessary or desirable. It is better for the
download to fail and the playbook execution to stop immediately
so that the failure point is exposed.

Change-Id: Ibe9d3a98e663cb1c1d7ae07aa10c9cee8e6aba3f
2016-11-07 17:39:13 +00:00
Jean-Philippe Evrard 635e3a6030 Remove ansible<2.2 apt cache hack
Now ansible apt module correctly behaves, so it's time
to deprecate these cruft tasks for apt.

Change-Id: I8cf3404243a92578a4ac644295e7897cb5db5176
2016-11-05 00:30:45 +00:00
Jean-Philippe Evrard eee216fdc4 Fix linting issues for ansible-lint 3.4.1
Preparing this role for the ansible-lint version bump

Change-Id: I157d31811c3104a75b14521a560a04f9bd5156b2
2016-11-04 17:39:22 +00:00
Jesse Pretorius ef36c27565 Simplify pip options/constraints mechanism
The current constraints generation for the
installation involves multiple tasks and multiple
variables.

Using multiple tasks extends the installation time
unnecessarily and the additional variables are
unnecessary.

This patch aims to simplify the mechanism and
hopes to speed it up a little.

Change-Id: I6784878e7a46560bebfb0be9d51b048da3774f70
2016-11-02 18:26:10 +00:00
Kevin Carter 6a2d0be83a Remove 'ignore_errors: true' in favor of 'failed_when: false'
This change removes the use of 'ignore_errors: true' because it causes deployers
to see red output and a stacktrace, which traditionally means something is broken,
even when the failure is known to have a fall back option or be intentional. This
conversion will provide a generally cleaner interface.

It should be noted that the 'failed' filter will still function normally. Tasks
with the 'failed_when: false' option will still be marked as 'failed' in any
registered variable. This change simply makes the output look cleaner.

Change-Id: Iafffee89b2629643799efd1e2fa233de9ca281f6
Closes-Bug: #1633438
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-10-14 16:46:43 -05:00
Jesse Pretorius e132122a84 Revert dynamic includes for inventory-based conditionals
Forcing dynamic includes for inventory-based conditionals
results in incomplete execution.

Change-Id: I2b1aba46918c262e53f46a843b6fb4669b17c367
2016-09-26 19:47:32 +01:00
Jesse Pretorius 79aec1112c Force Ansible to use dynamic includes
Ansible 2.1.1 introduces a regression in the way conditional
includes are handled which results in every task in the
included file being evaluated even if the condition for the
include is not met. This extends the run time significantly
for a deployment.

This patch forces all conditional includes to be dynamic.

Change-Id: Id26b3f254e68f0707c6d8b23b501868213b11224
Related-Bug: https://github.com/ansible/ansible/issues/17687
2016-09-22 16:33:00 +01:00
Jesse Pretorius 833d62c9fe Rename package lists (and related vars) appropriately
In order to make it easier to differentiate between the lists of
python packages, distribution packages, downloaded packages,
package pins and other similar variables the variable names are
being changed to ensure that they have a more explicit suffix
that defines the purpose and makes the naming more consistent.

This is to facilitate a lookup plugin which will be able to look
up all the package lists and present them as a consolidated piece
of data which may be used for artifact preparation.

Change-Id: Ib607e78bd3be2f50fbfe2c7098706df7e91cd780
2016-08-30 20:02:12 +01:00
Jesse Pretorius 65cd7cde31 Add ability to change apt/yum package state
The current method of installing the distribution packages required is
set in the tasks and cannot be changed by a deployer.

Currently the apt task always installs the latest package. This results
in unexpected binary changes when a deployer may simply be trying to
execute a configuration change.

This patch adds the ability for a deployer to change the desired state
so that the results are predictable.

Change-Id: I3e99a77fb53ba91367c6548523b9e0f3b910e469
2016-08-02 15:37:11 +01:00
Travis Truman da805c1133 Removing unused tasks and templates for upstart
The upstart service tasks and templates were not
being used by the role.

Change-Id: Ie0964c5402847f0bf4a98d3ff1d0c63f66e4d005
2016-07-27 16:50:42 -04:00
Travis Truman 35cde17905 Adding simple functional testing for the role
Previously only role convergence was tested.

This patch paves the way to have functional testing support
the addition of Xenial support as well as adding more
thorough functional testing using the Tempest plugin
available in the zaqar source.

Change-Id: I593fe5e61df2daca0857548394e04aa2afa35499
2016-07-21 17:58:56 -04:00
Jesse Pretorius 6dedbe271c Optimise pip install tasks
Unlike the Ansible apt module, the Ansible pip module does not
recognise a with_items list and process all the items at once.

To optimise the pip install tasks, this patch replaces the use
of with_items with a join filter so that the pip install task
does an install with all the packages in a list, ensuring that
the execution is one action instead of many.

Change-Id: Idfb5059b60b2edb61113fecc9ad33f90a2ab9e65
2016-07-18 16:32:31 +01:00
Anton Khaldin e3d63ab1ef Only install to virtual environment
Remove all tasks and variables related to toggling between installation
of zaqar inside or outside of a Python virtual environment.
Installing within a venv is now the only supported deployment.

Additionally, a few changes have been made to make the creation of the
venv more resistant to interruptions during a run of the role.
* unarchiving a pre-built venv will now also occur when the venv
  directory is created, not only after being downloaded
* virtualenv-tools is run against both pre-built and non pre-built venvs
  to account for interruptions during or prior to unarchiving

Change-Id: I4a67a53d3d685c1e2f937114352569c9f45a74a0
Implements: blueprint only-install-venvs
2016-07-08 02:10:49 -07:00
Travis Truman e065f77ee2 Address Ansible bare variable usage
When executing the role with Ansible 2.1, the following
deprecation warning is issued in the output for some tasks.

[DEPRECATION WARNING]: Using bare variables is deprecated.

This patch addresses the tasks to fix the behaviour appropriately.

Change-Id: I7a8a0b0dc3d479834a1f5d037aae382e2d51ccc1
2016-06-15 13:11:24 -04:00
Jean-Philippe Evrard dccd112650 Consistency for multi-os in the includes
This makes the include_vars consistent accross all the
openstack-ansible-.* repos.

Change-Id: Ifddda5385e1da8683e5682213d5847b432f66c5a
2016-06-02 14:21:23 +01:00
Amy Marrich 8a6f23e8de Updating os_zaqar to use the Multi-Distro framework
* The default apt packages have been moved into a var file that is only loaded when the detected OS is matched.
* The Install task file has had the apt specific tasks moved into a named install task file.

Change-Id: Id95826a9dd9e5d2ed83a95c3f02d18929735a8f2
Implements: blueprint multi-platform-host
2016-05-25 08:28:39 +00:00
Jesse Pretorius 6aa49a12ea Change pip install task state to 'latest'
Currently all pip install tasks only require the package to be
present. This means that when an environment undergoes a minor
upgrade the package is not upgraded to the same version that
was tested with. This ultimately results in a deployed
environment that does not match the tested environment.

While for the services installed into venvs this is not an
issue, it does affect those which do not use venvs and any
packages which are installed outside of a venv or on top
of a venv.

This patch changes the behaviour to ensure that the install
task will always use the latest available package. In
developer_mode this will mean using the version specified
in upper-constraints, and in an integrated build this will
mean the version which is available in the wheel repo's
folder for the tag.

Change-Id: I8d67e0a42b82c5502f10e9307fbfd932c1dd2476
2016-05-04 10:45:58 +01:00
Travis Truman 6c79f1cde1 Adding role convergence test
Functional testing will follow in another patch
but we should have convergence testing in the meantime.

Change-Id: Ib3d596eea7f6ded233a3b1f9a06e3e893764c0e5
2016-04-11 12:09:35 -04:00
Travis Truman 72a3b5da89 Removing unneeded with_items usage
Add clarity to the role's function by
removing usages of with_items where only a
single item is present.

Change-Id: Ic057e1fff4ae4f5969662230feb14561752b8d22
2016-03-29 10:55:31 -04:00
Jimmy McCrory 592eab69a8 Remove dependency on the Keystone admin auth token
Now that auth token usage is deprecated, prefer the admin
user and password for all zaqar setup tasks run against
keystone.

Default vars in keystone namespace have also been removed.

Change-Id: Ic6639d5765925ce6a50b3e9f701eafb45cd6a004
2016-03-17 16:03:26 -07:00
Lingxian Kong 50e596389b Add zaqar_local_mode 2016-03-15 15:11:37 +13:00
Lingxian Kong 141383b19e Initial commit for zaqar ansible role 2016-03-11 15:08:53 +13:00