Commit Graph

39 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov 70d3b8bcd9 Fix linters issue and metadata
With update of ansible-lint to version >=6.0.0 a lot of new
linters were added, that enabled by default. In order to comply
with linter rules we're applying changes to the role.

With that we also update metdata to reflect current state.

Change-Id: Ib46df44ae2251932cf9169721ef463f0ec78b64e
2023-07-11 19:31:03 +02:00
Erik Berg 908a377b2b Remove redundant vars line
This line snuck in with I636e89ba06e513a559a51b1086d8cb6885ecb3e4
probably to bring it in line with other OSA roles, but should already
be covered by the distribution_major_version line above.

Change-Id: I8bba19390e83fdf80255ca1fd41c1a6c9541b67f
2022-09-15 10:18:37 +02:00
Jonathan Rosser 7b231960a7 Refactor use of include_vars
Use a first_found lookup instead of a with_first_found loop so that
the 'paths' parameter can be used.

This ensures that only vars from the role are included, and not vars
from a parent calling role. This can happen when a parent role has
a higher priority vars file available for inclusion than the role
it calls.

Change-Id: I636e89ba06e513a559a51b1086d8cb6885ecb3e4
2022-01-12 08:43:27 +00:00
Dmitriy Rabotyagov 9e943af976 Fix linters
Change-Id: I70c1cbfa6385a288d81c2ab3bc4f187bed7c5fb4
2021-05-27 16:22:26 +03:00
Jonathan Rosser b53e30cdac Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: I8c5d46a9d612b6800b6dde37a324e2357cf99217
2021-02-23 09:21:01 +00:00
Dmitriy Rabotyagov 141db60ee6 Use systemd-journald instead of log files
This patch aims to migrate service from usage of regular syslog files
to journald.

Change-Id: I9ee285aeae85ccf6827a652dcd4ff06958141615
2019-07-22 16:40:36 +03:00
Jonathan Rosser 261db5b883 Change netcat to be a required package
Netcat is not a direct dependancy of memcached nor the playbooks in
this role, however other OSA roles delegate tasks to the memcached
container and run shell commands which use nc.

This patch ensures that netcat is explicity installed into the
memcached container and we do not rely on it being present in the
container base image.

Given that the memcached_test_distro_packages variable is no longer
used, the associated bits for it are also removed.

Change-Id: Id046aa97ed90654f1859e584891fe5228f96aa90
2018-10-25 10:18:57 +01:00
caoyuan 027fc70412 use include_tasks instead of include
Change-Id: I8735a23ac6ff3e6b6e0f74b595962ed9d50c3083
2018-07-24 20:47:25 +08:00
zhulingjie 1b6ceb12f3 Remove the unnecessary space
Change-Id: I8a1ac90a51841a0e39d838f267c67f5c43ead7d2
2018-07-11 23:04:52 -04:00
Jean-Philippe Evrard b78a565405 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: Iaab769237a607bf003fb70eb99ade309c112d6ac
2018-07-12 16:59:53 +02:00
Jean-Philippe Evrard f43f9d2370 Fix regression for bare metal nodes
When running on bare metal, the log folders are created in advance
to /openstack/log/aio1-memcached in a /var/log/memcached link.

The task ``Create memcached log dir`` would then fail with:
``/var/log/memcached already exists as a link``,
because the folder exists, and the exit 1 after the chown
would trigger.

This replaces the code with a more idempotent code:
If a change would be detected by chown -c, it would be listed
in the stdout, while the rc would still be 0.
An error in chown would still be rc != 0.

So we can use this different state to mark the task as changed
or not, and handle the create folder case when no folder exists.

Change-Id: I904f13d2ae02cd410edc4aaeb83bedd1e14d69fb
2017-12-06 10:32:25 +00:00
Andreas Jaeger 426a4f5f0d
Clean up the role and further isolate the service
This change cleans up the role a little bit making it more consistent.

A new configuration file has been added which will further isolate
our services using a named cgroup; this is similar to what we already do in
our openstack services. By further isolating the service from the system
we get quite a bit more control and accountability.

Change-Id: I02a84a2560853473c986ad0db26874341a23fc82
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2017-11-29 20:37:56 -06:00
Major Hayden 4ec27e6874
Add automatic restart for memcached
This patch ensures that systemd will restart memcached in case of
failure or if the process is manually killed.

Closes-Bug: 1659954
Change-Id: I6782320bf429cde17dff00401e7f136cfc979cee
2017-08-17 11:43:07 -05:00
Jesse Pretorius a9acd22e82 Disable PrivateDevices for MemcacheD on CentOS 7
This patch adds the `memcached_disable_privatedevices` variable that
allows deployers to disable PrivateDevices in the systemd unit file.

This is a workaround to fix the systemd/LXC issues with bind
mounting an already bind mounted `/dev/ptmx` inside the LXC
container.

See Launchpad bug, lxc/lxc#1623, or systemd/systemd#6121 for more
details.

The is_metal variable is removed as it is unused.

Related-bug: 1697531
Change-Id: Id7c148bf901354a3dfc2f189ec659f2b92fc7985
2017-06-15 11:56:18 +01:00
Jesse Pretorius d90f57aca9 Optimise the distro package installation
In order to optimise the distro package installation
process the list of packages to install is prepared
for the host, then installed by passing the package
task the full list instead of using a loop.

The package lists in defaults are removed as it is
undesirable to make it easy to override these lists.
This is not provided for in any other roles.

Change-Id: I71307d2a808fdc0f76e376a84651dad86b3f8b69
2017-06-08 17:00:26 +01:00
Jesse Pretorius b259318aee Optimise apt cache update task
In https://review.openstack.org/457391 we consolidated
the package install tasks into one set, but it's also
possible to provide the package action plugin the
parameters for the underlying module, so we do that
here to get rid of the apt cache update task.

The minimum Ansible version is raised to 2.2 due to a
known bug [1] in Ansible's apt module which does not
update the cache properly if the cache update and the
install are combined in a single task.

[1] https://github.com/ansible/ansible-modules-core/issues/1497

Change-Id: If3209379c04b3bfdf3fd8af8615fc6e0036b1c52
2017-04-20 15:12:59 +01:00
Jimmy McCrory d7e47fa89e Use package module to install distro packages
Consolidate distro package install tasks into a single taskfile using
the package module.

Change-Id: I6626132d8a22d07574826dde2e51bcfd79f116d9
2017-04-17 16:05:47 -07:00
Markos Chandras 58e17aa13e Add SUSE support
Add support for SUSE based distributions

Change-Id: Ib57cceeb9af4d1d0232a20622ad6efdba4cc346d
2017-04-04 16:22:08 +01:00
Jean-Philippe Evrard 5f0defd39b Use systemd module instead of shell
Using ansible systemd module to daemon reload and service reload
is the solution for the future. Let's embrace it!

Change-Id: Ic8d4312c2c7fe10ef4edb5b77a2068a21d8550db
Signed-off-by: Jean-Philippe Evrard <jean-philippe.evrard@rackspace.co.uk>
2017-01-19 10:57:14 +00:00
Jean-Philippe Evrard 7add9c06c8 Bring consistency to tags
We apply here our practices to have role_name-(config|install).

Change-Id: Ib17a8c0b43e844a5a50217fc3acaa606abc148ac
Signed-off-by: Jean-Philippe Evrard <jean-philippe.evrard@rackspace.co.uk>
2017-01-06 13:59:20 +00:00
Andy McCrae bb49d55afb Remove Trusty support from memcached_server role
Change-Id: Idf6c9f8ce01f467f30ceef72f6b22dd029b6e942
Implements: blueprint trusty-removal
2016-12-15 13:14:04 +00:00
Logan V bfce0b8a60 Use ansible_service_mgr fact
This patch removes some extra tasks for detecting systemd and uses
the `ansible_service_mgr` fact instead.

Partial-Bug: #1640125
Change-Id: I82e3284b1d46d32ec28502ac4fe1a322316ca019
2016-11-10 07:23:05 +00:00
Jean-Philippe Evrard 0799045799 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: I59c36e11fafa4842e1dde78c0afa0f757d5ba670
2016-11-03 23:31:55 +00:00
Logan V 29e9a089ed Fix linting issues for ansible-lint 3.4.1
Preparing this role for the ansible-lint version bump

Change-Id: I86aa6dd0cd9b39fa2c0652f0f13a15708922c396
2016-11-02 02:12:46 +00:00
Jesse Pretorius e16ddfd17a 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: Ide7992e9f83f5462c92f1b15d53a5eed2e9d8e95
Related-Bug: https://github.com/ansible/ansible/issues/17687
2016-09-22 12:11:39 +01:00
Paulo Matias 04941492c3 Adjust file descriptor limit when systemd is used
Change-Id: I29629ba3c78a55ebd63e4f9710ba71b85c488279
Related-Bug: #1623164
2016-09-15 17:23:37 -03:00
Marc Gariepy 50099568d2 Add retry to comply with the until loop
Change-Id: Ibbfbebb0b3b904deb340355e46c33e1b1e65fb1d
2016-09-08 09:34:01 -04:00
Jesse Pretorius 736969d00c 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: Ib3d6dea38bf4d570e6b9501f9cb89632639d586e
2016-08-30 16:21:01 +01:00
Kevin Carter 3ab920ce2b
Implement log directory link checking
This change implements the log directory link checking. This will ensure
the role is able to handle instances where memcached is deployed outside
of a container using the "is_metal: true" property from OSA.

Change-Id: Ia5e38dd1fda9f7fa5876e0a2824c88d0fa3d2b8d
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-08-08 23:51:54 -05:00
Jesse Pretorius 68e7e05ac8 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: Ieaa9fa9c6e0d0790b79d5d9d50fbe693a6091d2d
2016-08-02 07:48:48 +00:00
Travis Truman 76f4d7db4e Cleanup/standardize usage of tags
The numerous tags within the role have been condensed
to two tags: memcached-install and memcached-config

These tags have been chosen as they are namespaced
and cover the two major functions of the role.

Change-Id: Iabb2ae9bd314625e76c76aa1155a7918745fcc50
2016-06-10 09:49:02 -04:00
Jean-Philippe Evrard d76fb52cb2 Consistency for multi-os in the includes
This makes the include_vars consistent accross all the
openstack-ansible-.* repos.

Change-Id: Iadfefc945ad91c036106caf6083bb53dd8aad5f2
2016-06-02 14:19:18 +01:00
Jimmy McCrory 421a504df4 Use ansible-lint 2.7.0
ansible-lint 2.7.0 was recently released, update the role's test
requirements to use it.

The tox test has been changed to run ansible-lint against this role,
rather than the test playbook which would only apply to this role's
dependencies.

Also include a skip tag for the 'yum clean all' task since the yum
module currently does not have a way of executing this action.

Change-Id: Ie7c8a2c1635ba64ca64e71a6d80dc6545f86f4e5
2016-05-31 10:29:58 -07:00
Matt Thompson f0185d9d88 Updated role using the Multi-Distro framework
This commit updates the memcached_server role to work on Trusty,
Xenial, and CentOS 7.

NOTES:

1. This role no longer creates the memcache user since both Ubuntu and
   CentOS already install a suitable user
2. We have temporarily disabled testing of the log file since CentOS and
   Xenial do not log to file
3. On Ubuntu we drop ulimits into /etc/defaults/memcached, we need to
   figure out how to do the equivalent on CentOS
4. We update tasks/memcached_config.yml to use the correct memcached
   user in limits.conf, however neither these limits or the ones in
   templates/memcached.debian.j2 actually seem to be taking effect.
   More work in an additional review will need to be done to clean this
   all up.

Implements: blueprint multi-platform-host

Change-Id: I4c32f3d60939615c5d0c6fb202e96aacb35ab9b4
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-05-26 16:52:54 +01:00
Bjoern Teipel 5c2d8c55ec Configure nofile OS limit for memcached server role
This fix adds a new override `memcached_connections` which is
automatically calculated from the number of memcached
connection limit plus additional 1k to configure the OS nofile limit.
Without proper nofile limit configuration, memcached will crash
in order to support higher parallel connection TCP/Memcache counts.

Closes-Bug: #1582288

Change-Id: I558ba329b7247cdfcf660e392c3ae0c4a0d65a53
2016-05-17 12:11:40 -05:00
Travis Truman 3bebceb508 Ansible 2.x - Address deprecation warning of bare variables
Ansible 2.2 will not allow "bare" variable references
in with_* loops. See https://docs.ansible.com/ansible/porting_guide_2.0.html#deprecated
for details.

Change-Id: Icd072922773674e509d2d49cee9ba348e52e23ec
2016-04-19 17:13:18 -04:00
Jean-Philippe Evrard 2d937511d6 Improved logging for memcached
- Moved to the right folder to get it accessed on bare metal
  when containerized
- Making it work for rsyslog and logrotation's existing
  roles
- Changed the gate tests to reflect path change

Closes-Bug: #1569171

Change-Id: I3a1c2f50ab63b55b39318ba40c0921f6b738cafb
2016-04-13 18:16:07 +01:00
Jean-Philippe Evrard fe8509a241 Only update apt cache if necessary
Workarounding the upstream ansible apt module bug

documented here:

https://github.com/ansible/ansible-modules-core/pull/1517

For the next versions of ansible we'll be using, we should

check if the apt bug is fixed. When it's fixed, we could

abandon this change and use the standard apt module

with correct cache handling.

Change-Id: I900ea91ca60973fc72910d649ec1f994373fbe5f
2016-02-15 14:49:43 +01:00
Kevin Carter b818df54e2
first commit
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2015-12-09 09:24:22 -06:00