Commit Graph

48 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov dcf6aed584 Deprecate rsyslog_client role
Depends-On: https://review.opendev.org/c/openstack/project-config/+/863079
Change-Id: I47bcd43247e0d589932b63cec782567d33d35f28
2022-10-31 16:56:19 +01:00
Erik Berg 5ce81ac62a Remove redundant vars line
This line was introduced by I9d50c557ff6359c8db3c065edc68130de0aefdc9
for centos-7 support, but should since be covered by the
distribution_major_version line above, introduced at a later date.

Change-Id: I0c94adf0a0d2a2ec7eb90e86b6435f349f6db89c
2022-09-15 11:13:27 +02:00
Jonathan Rosser 3fe984ef0a 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: Ie02e3d6c769f3668a29f06af641f61c613eb74f7
2022-01-12 08:56:13 +00:00
Jonathan Rosser 7520c9a977 Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: I0817004e4399b08fe47143aa139a436687d5ea88
2021-03-16 08:53:12 +00:00
Jonathan Rosser bd77b290e5 Do not use 'skipped' test as a filter
Change-Id: I9e21a2995b36b9b7dd4d8f22bb3436621b0c0201
2019-09-10 13:04:54 +01:00
James Denton 70be33495f Templatize rsyslog configuration files
This patch differentiates rsyslogd configurations based on operating system
by defining respective system logfile location and user/group.

Change-Id: If5134278f7aa5e726325be38bb0bf8a560b668e5
Closes-Bug: #1807268
2019-02-14 14:24:38 +00:00
caoyuan d281666763 use include_tasks instead of include
Change-Id: Ibd99d704b9965b513cd2efa019a01b5fb4fa4dd1
2018-07-24 20:42:35 +08:00
Jean-Philippe Evrard 68a9655da1 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: Iee010bdcf55943f42433234d6c6f60ba103e6953
2018-07-12 17:04:35 +02:00
Jimmy McCrory 0ee4ebced1 Correct task tag
The 'Check if log dir exists' task is tagged as 'rsyslog_client-install'
but registers a variable that is only used by an 'rsyslog_client-config'
tagged task.

Change-Id: I97c3b37a4cc26f0f074f37f992d4764ab75abfdc
2018-01-31 09:32:09 -08:00
Andy McCrae 3b917569cd Append group permissions instead of clearing them
We set the groups for the syslog user to be "adm", but this will clear
any existing groups. That will mess with permissions in cases where we
want syslog to be in other groups for the ability to handle a different
applications logging.

Change-Id: If267cfd2f3f8f182c396e3f2836ec7e1d572fe0a
2017-10-31 12:31:23 +00:00
Logan V 424f2ae776 Cast the log file list as a list
The log file list, when empty, is cast as a string containing "set()",
which produces a broken log config file.

Closes-Bug: #1716138
Change-Id: If429ba3b63252d066db5a410b80ff29e813d96e1
2017-09-09 10:22:05 -05:00
Jean-Philippe Evrard 7b2cd66e97 Test postrotate works
We should:
- Not check what we do not set (kern.log and auth.log are already
defined in rsyslog file, which we do not template). These two
files would trigger an issue if both are in the same logrotate
configuration.
- Check that the rotation works, by forcing a rotation, and seeing
that the new files are empty.

Change-Id: I08357260e45919d9e71586cac6b9ce413adffc22
Closes-Bug: 1699875
Closes-Bug: 1709291
2017-08-23 20:19:45 +00:00
Jean-Philippe Evrard a7405329cd Remove when {{
Finally deprecated by ansible

Change-Id: Id07028be93704492344933c574f2d6c49a1461dd
2017-05-23 14:14:25 +01:00
Jesse Pretorius 7cfea8b6b5 Optimise apt cache update task
The update of the apt cache and the package installation
can all be handled in a single task by providing the
package action plugin with the right parameters. This
removes an extra task to optimise execution.

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: I171c4d7d6e051b69106156df797ea96d6184014a
2017-04-21 16:57:49 +01:00
Markos Chandras 5a150eee9b Add SUSE support
Add support for SUSE based distributions. We also update the bindep.txt,
run_tests.sh and Vagrantfile files from the openstack-ansible-tests
repository.

Change-Id: I9dd0290d9eb7be77446a6bd5c048ceb3371fa536
2017-04-05 18:24:52 +01:00
Ravi Kumar Boyapati 705b264df2 Fix remote logging template
Splitted functionality, one template for generating remote syslog
targets and another for streaming the user specifed log files in
syslog format. This avoids duplcate targets when the role is
invoked mutiple times against a host when installing services.

Change-Id: I53e2faf69c0446bea9738a66ee8585e8d795cf52
2017-03-13 16:17:31 -04:00
Andy McCrae 8e6b89c230 Test for rsyslog_all group before conditional
Roles that depend on the rsyslog_client role may not have rsyslog_all
servers setup - this will then fail as the group does not exist in the
inventory.

We should test whether the group exists, and skip if the group doesn't
exist or if the host is not in the group.

Change-Id: Ica4e2e5ab2cf7e433e2d8bff05c4bca70031a65d
2017-02-28 11:25:49 +00:00
Ravi Kumar Boyapati 931b04ed00 rsyslog client tasks overwriting rsyslog server config
when rsyslog client role is invoked as part of monitoring agent
installation across all hosts its breaking the rsyslog server.
Added conditions not overwrite the rsyslog configs on rsyslog servers.

Change-Id: Iea783d443af96d9996fd25ea9355f2930d82fb20
2017-02-25 18:04:27 -05:00
Yogesh Mulay c902307da5 Ensure rsyslog restarts after configuration file changes
Added rsyslog restart handlers to each rsyslog_client_post_install task.
There was an issue when rsyslog_client_post_install would stop its service,
it would automatically get restarted and the service would not listen
for incoming logs. This now ensures that the rsyslog service will
be restarted after configuration files are changed.

Change-Id: I0cc9dd512fba6a1d583bf861a645097ae7c1d852
Partial-Bug: 1636017
2017-02-24 11:32:52 -05:00
Jenkins 0dbf44a894 Merge "Using updated package module to install rsyslog client." 2017-01-22 02:51:39 +00:00
Andy McCrae a83b05b323 Fix conditional for rsyslog_client_all_log_files
When log_files isn't defined the "rsyslog_client_all_log_files" will
error out, so we conditionally create this depending on whether
log_files will have been created or not.

Change-Id: I51b16c234c0ddc88751b2e8af6c62688a3a518f0
2017-01-19 20:04:45 +00:00
Andy McCrae 6aa4db7a4f Fix conditionals for Log file union task
The task to perform a union on the log files will fail if the previous
task is skipped, since the value "log_files.files" is not defined.

We should skip the if the variable doesn't exist, since we already
conditionally perform the task that creates the "log_files" fact.

Change-Id: Iade36c8d79b0e0653c4f7348e609aa1f8d88a4a0
2017-01-19 15:29:06 +00:00
Donovan Francesco (drifterza) 9e1c6be4dd Using updated package module to install rsyslog client.
Change-Id: Idcc0fb5da65560e5c7fb55b8327de9b5c45c0ab1
2017-01-18 09:09:44 +02:00
Donovan Francesco (drifterza) 04fdc849be Using find module instead of shell command.
This patch also fixes the following nit.

Compute nodes have soft-links for log directories and currently
gets passed by this when clause:

  - log_dir.stat.isdir is defined and log_dir.stat.isdir

Removing this allows the find module to search through all log directories defined.

Change-Id: I69e2beee7a202f94cfcf13dba3d17c16cef252ed
Closes-Bug: #1636017
2017-01-17 15:33:31 +02:00
Jean-Philippe Evrard 73ef0ae379 Bring consistency to tags
Some tags were not applied on the highest level and forced duplication.
We apply here our practices to have role_name-(config|install) [1].

[1]: http://docs.openstack.org/developer/openstack-ansible/developer-docs/contribute.html#ansible-style-guide

Change-Id: I210461d9b3a16f644043ce429029d2163a8ae347
2017-01-16 10:32:28 +00:00
Logan V f57486e1a9 Fix log search dir conditional
Fix bug with search dir conditional introduced by
Iba17bed79e26e6e7eb2300d413058145ec680d87.

Change-Id: I291e3582e5cb01f4a9c394bc8e7d8289ca577f90
Closes-Bug: #1648490
2016-12-08 09:48:43 -06:00
Jenkins c0a2d4df9d Merge "Fix rsyslog_client_log_dir to be optional" 2016-11-14 14:41:07 +00:00
Logan V 16f933ab12 Fix rsyslog_client_log_dir to be optional
Fix the regression introduced in
I371d0bbbd1f9dfa893df054471f17f5cc4b640df which causes
the role to fail if a log directory is not provided.

Change-Id: Iba17bed79e26e6e7eb2300d413058145ec680d87
2016-11-14 06:51:33 -06:00
Marc Gariepy 044894126b Add /bin/false shell to syslog user
if not specified it does default to /bin/bash

Change-Id: I2b79428f1da46a11b4939305eb73862c540ae846
2016-11-11 14:39:09 -05:00
Jean-Philippe Evrard 81be10cec1 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: If91782644592f70d348ea60b25f010d67c7db988
2016-11-03 23:42:25 +00:00
Logan V 491fb7d4d0 Fix linting issues for ansible-lint 3.4.1
Preparing this role for the ansible-lint version bump

Change-Id: I0a192ebd062e09c41ec0acaa43ed8cbb628f91f5
2016-11-02 13:31:04 +00:00
Ravi Gummadi 06e04a7fdf Fix errors due to repo_service_user_name setting
Changing the paths of nginx logs to not rely on the
 user name of repo service. This is because nginx related
 configurations, playbooks assume nginx in the directory names.

Change-Id: I84f7e029ff0ce5d0c79acbd2e401d93d8fd2963c
Closes-Bug: #1633739
2016-10-23 05:10:30 -05:00
Jesse Pretorius a1cb34b9b6 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: Idaf2a72b1744d223d913991fda70af109a51dfa4
Related-Bug: https://github.com/ansible/ansible/issues/17687
2016-09-22 15:59:47 +01:00
Kevin Carter 03049027af
Add check to ensure a target log dir exists
This check adds a check to ensure that a target log directory
exists prior to running the "find" comand to index specific log
files.

Change-Id: I371d0bbbd1f9dfa893df054471f17f5cc4b640df
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-09-15 10:00:58 -05:00
Travis Truman ba6de3ea83 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: If3816d9c79ecd1a61a3a53fed95828bff6d91181
2016-08-26 13:11:48 -04:00
Jesse Pretorius c0cff7b366 Remove rsyslog_client_repos var and fix apt cache updating
The ability to implement a custom apt/yum repository for rsyslog_client
has been removed as it is unused. Deployers may opt to do this in
a number of other methods (including customising the base container
cache) which do not require us to maintain this code.

Having this ability there resulted in the apt cache updating every time
the role executed even though there was no repo being added.

The cache_timeout variable is moved to the role defaults to allow it
to be overridden more easily and to be exposed in the role docs.

Change-Id: I113c9803495f2a935b99f272c387a4304a149cbf
2016-08-22 15:15:20 +00:00
Jesse Pretorius ef0664ffe2 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: Ie75b2eb144a622373ff204b4a9d79a8791ea4790
2016-08-02 15:46:54 +01:00
Jimmy McCrory 6c1f43a4cc Allow overriding of default logrotate options
Two variables have been added, rsyslog_client_log_rotate_options
and rsyslog_client_log_rotate_scripts, to allow deployers to override
and set logrotate config options as they wish.

The os_aggregate_storage.j2 template has also been renamed to
logrotate.j2 to better fit its purpose.

Change-Id: If7538fd2409f3583f22209868f538e01796813c2
2016-07-05 20:38:39 -07:00
Travis Truman 52020882f0 Cleanup/standardize usage of tags
The numerous tags within the role have been condensed
to two tags: rsyslog-client-install and rsyslog-client-config

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

Change-Id: Ie673eb71affc5bc550a06f53646e6b4569d15ff0
2016-06-20 12:20:03 -04:00
Gaudenz Steinlin 6910847bce Fix config generated for rsyslog_client_log_files
The rsyslog_client_log_files role variable was masked by the
rsyslog_client_log_files fact set during the post install task. This
caused the log files set in the rsyslog_client_log_files variable to be
ignored on the second or later invocation of the rsyslog_client role.
Instead the log files discovered from rsyslog_client_dir on previous
runs of the role were add to the list of logfiles. This resulted in
missing rsyslog configurations and duplicate logrotate entries.

Change-Id: I00a58def426a4f30f1e64a24320ee68157b95f24
2016-06-15 14:55:26 +02:00
Jenkins 8f2d062e8d Merge "Add CentOS7 support to rsyslog client" 2016-06-03 18:44:15 +00:00
Jean-Philippe Evrard 232bf64dec Consistency for multi-os in the includes
This makes the include_vars consistent accross all the
openstack-ansible-.* repos.

Change-Id: Ia92db603d3f8bd9a1845ca343b3fda379068ffe3
2016-06-02 14:22:06 +01:00
Kevin Carter 93ff2c41bb
Add CentOS7 support to rsyslog client
This change adds a new variable and task file for supporting
CentOS7 based deployments.

Change-Id: I9d50c557ff6359c8db3c065edc68130de0aefdc9
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-06-01 13:45:14 -05:00
Travis Truman 51d8a9e2df Multi-distro pattern for rsyslog-client role
This is an implementation of a pattern for multi-distro support

This allows for support of distros other than Ubuntu

Change-Id: Ide94831464a74827d5c46b38557e483aaf4180d0
2016-04-27 11:22:12 -04:00
Travis Truman f7492556f9 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: Ib71579d1e0f88d1acc0889cdd29a3fa89157b30e
2016-04-20 09:33:59 -04:00
Jean-Philippe Evrard ff71d49ce9 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: I72cdba6820f1ec0066567b5cde539f018b5779b9
2016-02-15 14:49:43 +01:00
Kevin Carter 80b47a87e6 Added conditional templating
The change adds a conditional to the log rotate template
so that its only rendered when log files are present in the
log file discovery task.

Closes-Bug: 1539210
Change-Id: I3fba6eda958ce4f857dc5f06b5c700cbd3735c89
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-02-02 16:31:55 +00:00
Kevin Carter ed60bae35a
IRR for rsyslog_client
The change moves the role out from the main repo rsyslog_client
repository and into its own standalone repository.

Items within this change:
  * The role has been updated to ensure it runs standalone.
  * Tests added to the role within tox.
  * Functional tests added to the role that can either be run
    via the run_tests.sh script or using tox.
  * dev requirements have been updated for testing usecases.
  * Docs added to both the README.rst file as well as the docs
    folder.

Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2015-11-03 02:27:54 -06:00