Commit Graph

41 Commits

Author SHA1 Message Date
Guilherme Steinmüller 1f61130240 Retire openstack-ansible-os_watcher
Change-Id: I0dfd5318a7b953618673eb4ffd17f89a1cf900c4
2019-04-24 16:51:54 -04:00
OpenStack Proposal Bot 3583db9eee Updated from OpenStack Ansible Tests
Change-Id: I39cfb0a3e6b2711f34c20c794856729b84a769a7
2019-04-17 19:12:26 +00:00
OpenStack Proposal Bot c396977e9b Updated from OpenStack Ansible Tests
Change-Id: I94f27bcc6a6bedcedc6d9953bcdfb4257837d4e3
2019-04-17 07:26:09 +00:00
OpenStack Proposal Bot 19b5b7a492 Updated from OpenStack Ansible Tests
Change-Id: Iaccabb7a6415ceccb1a3ea758858fb2c11d8b76b
2019-04-13 20:24:02 +00:00
OpenStack Proposal Bot 181cffb42f Updated from OpenStack Ansible Tests
Change-Id: I56f63321a47802856e1e6bb388de2fb13e362281
2019-04-01 13:19:34 +00:00
Jesse Pretorius 723eb345ea 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: I25e6d1a047423b719a5f77bb46b529a667dbfa7a
2018-11-30 16:57:34 +00:00
zhulingjie dfa8ff82ed Remove the static when use include_tasks feature
Change-Id: I36c1bd6c72d56f704e6e838a5b43b6e08b4124fc
2018-09-01 22:31:07 -04:00
Jesse Pretorius 308665677c 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.
2. Simplifies the installation of optional pip packages.
   Right now it's more complicated than it needs to be due
   to us needing to keep the py_pkgs plugin working in the
   integrated build.
3. Deduplicates the distro package installs. Right now the
   role installs the distro packages twice - just before
   building the venv, and during the python_venv_build role
   execution.

Depends-On: https://review.openstack.org/598957
Change-Id: I1c2f5d7ef1bb6913f3809c7fd9d9a36cacd0ab4a
Implements: blueprint python-build-install-simplification
Signed-off-by: Jesse Pretorius <jesse.pretorius@rackspace.co.uk>
2018-09-03 18:01:50 +01:00
OpenStack Proposal Bot 7543cc9edd Updated from OpenStack Ansible Tests
Change-Id: Ibc56c3bb84d1713de32a29bf451b1cd44b8e40db
2018-08-20 10:50:50 +00:00
Zuul 0574b9c845 Merge "Use include_tasks instead of include" 2018-08-17 04:06:41 +00:00
OpenStack Proposal Bot 3ce1f7fe5b Updated from OpenStack Ansible Tests
Change-Id: I967d719e0bb21f68741b0b3273fbf38ba44c8d53
2018-08-15 13:42:26 +00:00
caoyuan ffd4d551ee 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: I144d570555780b46ed132e4895d9f640f2d95555
2018-08-15 06:28:28 +00:00
Jesse Pretorius 69e0732b92 Allow tags to be used for MQ tasks
The use of 'include_tasks' and a loop of variables creates
a situation where a user is unable to use tags to scope the
inclusion of only the MQ tasks when running the playbooks.

The use-case this is important for is when the rabbitmq
containers are destroyed and rebuilt in order to resolve
an issue with them, and the user wishes to quickly recreate
all the vhosts/users.

Ansible's 'include_tasks' is a dynamic inclusion, and dynamic
inclusions are not included when using tags. The nice thing
about dynamic inclusions is that they completely skip all
tasks when the condition does not apply, cutting down deploy
time. However, given the use-case, we should rather take on
the extra deployment time.

This patch changes the dynamic inclusion to a static one,
adds a 'common-mq' tag to cover all MQ implementations,
and re-implements the 'common-rabbitmq' tag for the tasks
that relate to RabbitMQ specifically.

It also implements conditionals for each task set so that
the rpc/notify tasks can be skipped if a vhost/user is not
required for that purpose (eg: swift does not use RPC, and
most roles will not use notifications by default).

Depends-On: https://review.openstack.org/588191
Change-Id: I43b13a1c4eda4a8742227380c3fbc1ca9a489408
2018-08-07 15:08:12 +01:00
Jesse Pretorius 2ab1b99446 Move MQ vhost/user creation into role
There is no record for why we implement the MQ vhost/user creation
outside of the role in the playbook, when we could do it inside the
role.

Implementing it inside the role allows us to reduce the quantity of
group_vars duplicated from the role, and allows us to better document
the required variables in the role. The delegation can still be done
as it is done in the playbook too.

In this patch we implement two new variables:
- watcher_oslomsg_rpc_setup_host
- watcher_oslomsg_notify_setup_host

These are used in the role to allow delegation of the MQ vhost/user
setup for each type to any host, but they default to using the first
member of the applicable oslomsg host group.

We also adjust some of the defaults to automatically inherit existing
vars set in group_vars form the integrated build so that we do not
need to do the wiring in the integrated build's group vars. We still
default them in the role too for independent role usage.

Finally, we remove the test mq setup tasks and clean up any unused
or unnecessary variables configured in tests.

Change-Id: I6b781cde4e075dee9d79cf28a55eeda00460c37d
2018-07-27 12:24:39 +01:00
Andy Smith cbe8947272 Update to use oslo.messaging service for RPC and Notify
This introduces oslo.messaging variables that define the RPC and
Notify transports for the OpenStack services. These parameters replace
the rabbitmq values and are used to generate the messaging
transport_url for the service.

This patch:
* Add oslo.messaging variables for RPC and Notify to defaults
* Add transport_url generation to conf template
* Add oslo.messaging to tests inventory and update tests
* Update readme
* Install extra packages for optional drivers
* Add release note

Change-Id: Ie43bcf4c5a8414072f1917ab8b30a034a514c51b
2018-07-26 09:16:46 +00:00
Jesse Pretorius 4bffc1e91f 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.

Change-Id: I32752523e9ed484bf0864be4db146bb333f9f55e
2018-07-14 14:43:20 +01:00
Jean-Philippe Evrard f3ba0f0be6 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: I595862a7cbee4c10ea0744055391754536b7f312
2018-07-12 16:54:31 +02:00
Jesse Pretorius 59acdd8c68 Move database creation into role
There is no record for why we implement the database creation outside
of the role in the playbook, when we could do it inside the role.

Implementing it inside the role allows us to reduce the quantity of
group_vars duplicated from the role, and allows us to better document
the required variables in the role. The delegation can still be done
as it is done in the playbook too.

In this patch we implement a new variable called 'watcher_db_setup_host'
which is used in the role to allow delegation of the database setup
task to any host, but defaults to the first member of the galera_all
host group. We also document the variable 'watcher_galera_address' which
has been used for a long time, but never documented. A bunch of unused
variables have also been removed.

Change-Id: I3b845ee913e3abc70bbc59b85142ebd55b92de51
2018-06-29 13:23:31 +00:00
Jesse Pretorius 1f606ff461 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: I9205f5f3183eff8059e7589b6a3a2bbf36f8b60a
Partial-Bug: #1764470
2018-04-20 14:20:01 +00:00
Jesse Pretorius 1bb9e0ee3f Do not log passwords
This prevents data to be leaked into the callback plugin.

Change-Id: Ib2f74474b8615d7be3d9b04c3040e9b25fa2d695
2018-04-20 15:19:44 +01:00
Jean-Philippe Evrard 131ddf78c8 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: Icdfb34cd2044ffb195acf68f036aaeea75630088
Partial-Bug: #1741634
2018-01-19 16:11:18 +00:00
Zuul 7765dd2adb Merge "Replace virtualenv-tools by a script" 2018-01-16 13:49:39 +00:00
Jean-Philippe Evrard e1fdd13c0c Use systemd module instead of command
This causes linters to break: since ansible 2.4 the systemd
module can have only the daemon_reload directive.

Change-Id: I66b041ebb22cba1abd92d5d0d36f206971ab555b
2018-01-15 15:27:18 +00:00
Jean-Philippe Evrard f905525ba2 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: I1d6eb2e90ea127d8646a7ced827a6793a86e3ad1
Partial-Bug: #1741634
2018-01-15 14:18:33 +00:00
Andy McCrae 4b6822cbbf 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: I5f0b769503de5b4c45e6d3a57ac45f13473d1d27
2017-05-26 12:03:14 +01:00
Rick Box 4e4600ef93 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: I290fd1e5763bc89028bb9207dbd0bba33bacaa06
2017-05-16 11:44:58 +00:00
Kevin Carter 539cc073ee Ensure the components are isolated from the system
This creates a specific slice which all OpenStack services will operate
from. By creating an independent slice these components will be governed
away from the system slice allowing us to better optimise resource
consumption.

See the following for more information on slices:

* https://www.freedesktop.org/software/systemd/man/systemd.slice.html

See for following for more information on resource controls:

* https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html

Tools like ``systemd-cgtop`` and ``systemd-cgls`` will now give us
insight into specific processes, process groups, and resouce consumption
in ways that we've not had access to before. To enable some of this reporting
the accounting options have been added to the [Service] section of the unit
file.

Change-Id: I1edfb6bd1896f8c2b6f26c77ba02923e69fb2f37
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2017-03-30 15:07:48 +00:00
Logan V dadc21ff4e 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: I4f0ad47547ef9c85dda33ec93de186125323bc9f
2017-01-13 19:52:42 -06:00
Jesse Pretorius 28c8fda049 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: I791eddf84e91773042b0f8c956c9884e97add591
Partial-Bug: #1637509
2016-11-16 09:14:36 +00:00
Jenkins cea2964d7d Merge "Remove join filter from pip module tasks" 2016-11-10 09:55:27 +00:00
Jesse Pretorius 79b573451a 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: I22304c2d6b019fae8e4234548c3811cb8b1eb02f
2016-11-09 21:54:44 +00:00
Jesse Pretorius c4315fcfce 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: I57d8e2852bd9144e04d614b567222b6950563d92
2016-11-09 21:53:32 +00:00
Jesse Pretorius ba39fc1731 Fix linting issues for ansible-lint 3.4.1
Preparing this role for the ansible-lint version bump

Change-Id: Id2e037949562796d2608626ed8b1be7e004c099a
2016-11-09 21:50:56 +00:00
Jenkins 0767a7b026 Merge "Remove ansible<2.2 apt cache hack" 2016-11-04 14:54:49 +00:00
Jean-Philippe Evrard 99f4e5f877 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: Ifb2da4d8f269c2c983c552ec98bb7a7935433dda
2016-11-03 23:39:47 +00:00
Jesse Pretorius 66e90e0f03 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: If468740e7ce07c272f982c2d09709bf0bb2cdfbe
2016-11-02 18:26:42 +00:00
Kevin Carter eaac2a2ecc 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: I9f973a7ab43d12eb002b0843552bf20b38d8cc6d
Closes-Bug: #1633438
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-10-14 16:46:38 -05:00
Jesse Pretorius 13c904bc75 Revert dynamic includes for inventory-based conditionals
Forcing dynamic includes for inventory-based conditionals
results in incomplete execution.

Change-Id: I185ff25bea1b9c23d780203da1b571f6ad1dd854
2016-09-26 19:45:07 +01:00
Jesse Pretorius d74a847fc6 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: I8ebc3b5f627c3f5fa1f0b20aece10e49ce6220cd
Related-Bug: https://github.com/ansible/ansible/issues/17687
2016-09-22 16:34:00 +01:00
Jesse Pretorius 164d780731 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: I4e87b0e30d9c26f664b499a786009b4f60357a03
2016-08-30 20:01:21 +01:00
Michael Gugino 76a013f814 Initial commit
This is the initial commit for the watcher role.
2016-08-22 13:37:00 -04:00