Skip to content

Fix and refactor logging_purge_confs and logging_restore_confs

Compare
Choose a tag to compare
@richm richm released this 19 Jan 02:32

[FIX] "Purge original conf" task

file module state=absent does not work with path=/some/dir/* (wildcard)
file module should support state=empty see: ansible/ansible#18910
state=empty is needed here - and should be used later
Use rm -rfv so that the files being removed will be shown

Refactor logging_purge_confs and logging_restore_confs.

  • logging_purge_confs: true or false.
    If logging_purge_confs is set to true, remove files in rsyslog.d
    which do not belong to any rpm packages. That includes config files
    generated by the previous logging role run.
    Default to false.
  • logging_reset_confs: true or false.
    If logging_reset_confs is set to true, reinstall rsyslog package,
    and restore the pre-existing config files, which restores the
    default /etc/rsyslog.conf.
    Default to false.

Note: Variable logging_restore_confs is replaced with logging_reset_confs.

Other changes in the refactor:

  • A test case is added to tests_basics_forwards TEST CASE 2, where
    the even if the config files installed by other packages are
    accidentally removed, it's verified that the logging system
    (rsyslog) can be reset and restarted with "logging_reset_confs:
    true" in the cleanup playbook.
  • A test case only sets purge and reset is added.