Ansible Role shared¶
This role bundles helper tasks reused across other LFOps roles and playbooks. It is not designed to be run as a whole; instead, callers import individual tasks via import_role / include_role with tasks_from:.
Available since LFOps 2.0.1.
Available Tasks¶
log-start.yml and log-end.yml
Append a
START/ENDline to/var/log/linuxfabrik-lfops.logon the target host. Includes the playbook name as well as run/skip tags. No-op in--checkmode and on Windows. Used aspre_tasks/post_tasksin every LFOps playbook.Parameters: none.
platform-variables.yml
Loads OS-family / distribution / version-specific
vars/<name>.ymlfiles of the calling role, in order from least to most specific (e.g.RedHat.yml->RedHat8.yml->Rocky.yml->Rocky8.yml->Rocky8.10.yml). Missing files are skipped silently.Parameters: none. Relies on
ansible_parent_role_paths[0](i.e. it must be imported from another role).
clone-lib-repo.yml
Clones the Linuxfabrik Python Libraries to
/tmp/ansible.lib-repoon the Ansible controller (delegate_to: localhost,run_once,--check-safe). Includes a rescue path that wipes the directory and retries on failure (e.g. when an existing checkout is on a different ref).Parameters:
shared__lib_version: Mandatory. The git ref to check out. Accepts'dev'(resolved tomain), a tag like'v1.2.3', or a bare version like'1.2.3'(auto-prefixed withv).
clone-monitoring-plugins-repo.yml
Same as
clone-lib-repo.ymlbut for the Linuxfabrik Monitoring Plugins. Target on the controller:/tmp/ansible.monitoring-plugins-repo.Parameters:
shared__monitoring_plugins_version: Mandatory. Same semantics asshared__lib_version.
remove-rpmnew-rpmsave.yml
Removes
<file>.rpmnew,<file>.rpmsave,<file>.dpkg-distand<file>.ucf-distfor a single config file. Only runs whenlfops__remove_rpmnew_rpmsaveistrue(LFOps-wide opt-in, see the main README).Parameters:
shared__remove_rpmnew_rpmsave_config_file: Mandatory. Absolute path of the deployed config file (without the.rpmnew/.rpmsavesuffix).
Usage Example¶
- name: 'Set platform/version specific variables'
ansible.builtin.import_role:
name: 'shared'
tasks_from: 'platform-variables.yml'
tags:
- 'always'
- name: 'Remove rpmnew / rpmsave'
ansible.builtin.include_role:
name: 'shared'
tasks_from: 'remove-rpmnew-rpmsave.yml'
vars:
shared__remove_rpmnew_rpmsave_config_file: '/etc/example/example.conf'