bodsch.systemd.journalctl (1.1.0) — module

Query the systemd journal with a very limited number of possible parameters.

| "added in version" 1.1.0 of bodsch.systemd"

Authors: Bodo 'bodsch' Schulz <bodo@boone-schulz.de>

Install collection

Install with ansible-galaxy collection install bodsch.systemd:==1.1.0


Add to requirements.yml

  collections:
    - name: bodsch.systemd
      version: 1.1.0

Description

Query the systemd journal with a very limited number of possible parameters.

In certain cases there are errors that are not clearly traceable but are logged in the journal.

This module is intended to be a tool for error analysis.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: chrony entries from journalctl
  bodsch.systemd.journalctl:
    identifier: chrony
    lines: 50
  register: journalctl
  when:
    - ansible_service_mgr == 'systemd'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: journalctl entries from this module
  bodsch.systemd.journalctl:
    identifier: ansible-journalctl
    lines: 250
  register: journalctl
  when:
    - ansible_service_mgr == 'systemd'

Inputs

    
unit:
    description:
    - Show logs from the specified unit
    required: false
    type: str

lines:
    description:
    - Number of journal entries to show
    required: false
    type: int

reverse:
    description:
    - Show the newest entries first
    required: false
    type: bool

arguments:
    description:
    - A list of custom attributes
    required: false
    type: list

identifier:
    description:
    - Show entries with the specified syslog identifier
    required: false
    type: str

Outputs

cmd:
  description:
  - journalctl with the called parameters
  type: string
rc:
  description:
  - Return Value
  type: int
stderr:
  description:
  - The output as a list on stderr
  type: list
stdout:
  description:
  - The output as a list on stdout
  type: list