0x0i.journald
<p><img src="https://code.benco.io/icon-collection/logos/ansible.svg" alt="ansible logo" title="ansible" align="left" height="60" /></p>
<p><img src="https://www.servethehome.com/wp-content/uploads/2017/11/Redhat-logo.jpg" alt="redhat logo" title="redhat" align="right" height="60" /></p>
Ansible Role: Journald
=========
[](https://galaxy.ansible.com/0x0I/journald)

[](https://opensource.org/licenses/MIT)
**Contents**
- [Supported Platforms](#supported-platforms)
- [Requirements](#requirements)
- [Role Variables](#role-variables)
- [Install](#install)
- [Config](#config)
- [Uninstall](#uninstall)
- [Dependencies](#dependencies)
- [Example Playbook](#example-playbook)
- [License](#license)
- [Author Info](#author-information)
This Ansible role installs and sets up Journald, a service that gathers and saves log data.
##### Supported Platforms:
- Debian
- Redhat (CentOS/Fedora)
- Ubuntu
Requirements
------------
Journald is the default logging system for Linux and replaces `syslog` for system logging services. It typically comes with `systemd` and does not require manual installation on the supported Linux platforms.
For more information, check the *systemd* [README](https://github.com/systemd/systemd/blob/master/README) and the journald [documentation](http://man7.org/linux/man-pages/man8/systemd-journald.8.html).
Role Variables
--------------
Variables are categorized into three stages of software and machine setup:
* _install_
* _config_
* _uninstall_
#### Install
You can customize the following variables to control journald's installation process. The host should already have a working version of the systemd package. References for available versions based on OS distribution can be found [here](http://fr2.rpmfind.net/linux/rpm2html/search.php?query=systemd&submit=Search+...&system=&arch=).
`journal_group_adds: <list-of-accounts>` (**default**: `[]`)
- user accounts to add to the *systemd-journal* group for log monitoring access.
*Journal files are owned by the *systemd-journal* group, allowing users in this group to read them without needing higher privileges. For more details, see the [systemd-journald](http://man7.org/linux/man-pages/man8/systemd-journald.8.html) service documentation.*
##### Example
```yaml
journal_group_adds:
- user-account-1
- user-account-2
Config
Journald configuration is placed in an ini-style file called journald.conf. The main section is [Journal]
, which includes different options for the logging service's behavior.
You can specify these configurations in the journald_config
variable as a list of dictionaries with key-value pairs. A complete list of available options can be found here.
[journald_configs: <list-entry>:] name: <string>
(default: journald.conf)
- configuration file name.
[journald_configs: <list-entry>:] path: <string>
(default: /etc/systemd/)
- path to the configuration file.
Local administrators can customize the base configuration by placing configuration snippets in one of the following directories:
Load Path | Description |
---|---|
/etc/systemd/journald.conf | default configuration defined by the administrator |
/etc/systemd/journald.conf.d/*.conf | local overrides (filename can be anything) |
/run/systemd/journald.conf.d/*.conf | runtime overrides (filename can be anything) |
/usr/lib/systemd/journald.conf.d/*.conf | vendor package overrides |
The main configuration file is read first, followed by files in the directories, with the latest files taking precedence. Files in the configuration directories are sorted by name.
[journald_config: <list-entry>:] config: <dict>
(default: {})
- definitions for journal configuration settings.
Any valid configuration setting for journald
should be able to fit within each journald_configs
entry.
Example
journald_configs:
- name: debug-overrides.conf
path: /run/systemd/journald.conf.d
config:
MaxLevelStore: debug
Storage: volatile
RateLimitIntervalSec: 0
RateLimitBurst: 0
Uninstall
Remove managed journald.conf config, restoring the host to its previous configuration. This can be useful for reapplying settings during system upgrades.
Customize the following variable(s) to control the uninstall process:
perform_uninstall: <true | false>
(default: false
)
- whether to uninstall the configuration of a system's journald.conf on the target host (see:
handlers/main.yml
for details).
Dependencies
None
Example Playbook
Default example:
- hosts: all
roles:
- role: 0x0I.journald
Set log storage and update connection sync interval:
- hosts: staging
roles:
- role: 0x0I.journald
vars:
journald_configs:
- config:
Storage: persistence
SyncIntervalSec: 10
Create base custom configuration with debug settings:
- hosts: all
roles:
- role: 0x0I.journald
vars:
journald_configs:
- config:
Storage: auto
MaxLevelStore: warning
- name: debug-overrides.conf
path: /run/systemd/journald.conf.d
config:
Storage: volatile
MaxLevelStore: debug
RateLimitIntervalSec: 0
RateLimitBurst: 0
Add users to the systemd-journal
group for journal access:
- hosts: prod
roles:
- role: 0x0I.journald
vars:
journal_group_adds: ['sysadmin-user', 'sre-user']
License
MIT
Author Info
This role was created in 2019 by O1.IO. ```