ramondevprivate.common.fleet_snapshot filter – Build the fleet snapshot of one host from its facts

Note

This filter plugin is part of the ramondevprivate.common collection (version 1.0.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install ramondevprivate.common.

To use it in a playbook, specify: ramondevprivate.common.fleet_snapshot.

New in ramondevprivate.common 1.0.0

Synopsis

  • Reduces ansible_facts to what the fleet inventory documents. OS, kernel, cores, RAM, disk capacity of real filesystems, and the IP addresses of relevant interfaces.

  • Bind mounts and pseudo filesystems are not counted, and each device counts once.

  • Interfaces lo, docker0, br-* and veth* are skipped.

Input

This describes the input of the filter, the value before | ramondevprivate.common.fleet_snapshot.

Parameter

Comments

Input

dictionary / required

The ansible_facts of the host.

Positional parameters

This describes positional parameters of the filter. These are the values positional1, positional2 and so on in the following example: input | ramondevprivate.common.fleet_snapshot(positional1, positional2, ...)

Parameter

Comments

host

string / required

Inventory name of the host.

collected_at

string / required

Collection time as ISO 8601 string.

collected

dictionary / required

The fleet result of the ramondevprivate.common.fleet_info module (users, SSH settings, UFW, listening sockets, Docker daemons, fail2ban, auto-updates).

Examples

- name: Build snapshot
  ansible.builtin.set_fact:
    snapshot: >-
      {{ ansible_facts | ramondevprivate.common.fleet_snapshot(inventory_hostname, now(utc=true, fmt='%Y-%m-%dT%H:%M:%SZ'),
                                                               fleet_info_result.fleet) }}

Return Value

Key

Description

Return value

dictionary

The snapshot, as stored in the JSON files.

Returned: success

Authors

  • Ramon (@RamonDevPrivate)