DEBOPS.SYSNEWS(5)

NAME
debops.sysnews - Manage System News using Ansible

SYNOPSIS

debops run service/sysnews [--limit group,host,...] [--diff] [--check] [--tags tag1,tag2,...] [--skip-tags tag1,tag2,...] [<ansible-playbook options>] ...

DESCRIPTION

This role can be used to manage "System News" bulletin displayed after users log in to a particular host using local system console or SSH. System News can be used to notify users about important changes on the host; this is especially useful in multi-user environments or on bastion hosts.

The System News can be read by executing the news command in the shell. You can read all of the news entries by executing the news -a command.

GETTING STARTED

  How to add news manually

The System News entries added by this role using sysnews__*_entries variables are permanent, ie. they will not expire automatically after a month.

System administrators can add more temporary news entries by putting text files in the /var/lib/sysnews/ directory, with the filename being the title of a news item. This directory is owned by the staff UNIX system group, and any users in this group can also add entries in that directory. Custom news entries will be automatically removed after a month.

To make temporary news items permanent, you can edit the /var/lib/sysnews/.noexpire file. Put names of the custom files to retain outside of the ANSIBLE MANAGED BLOCK section, this way your custom changes will be preserved during the next Ansible run of this role.

  Example inventory

The debops.sysnews role can be enabled on a host when it's added to a particular Ansible inventory group:

[debops_service_sysnews]
hostname

  Example playbook

If you are using this role without DebOps, here's an example Ansible playbook that uses the debops.sysnews role:

---
- name: Manage System News entries
  collections: [ 'debops.debops', 'debops.roles01',
                 'debops.roles02', 'debops.roles03' ]
  hosts: [ 'debops_service_sysnews' ]
  become: True
  environment: '{{ inventory__environment | d({})
                   | combine(inventory__group_environment | d({}))
                   | combine(inventory__host_environment  | d({})) }}'
  roles:
    - role: sysnews
      tags: [ 'role::sysnews', 'skip::sysnews' ]

DEFAULT VARIABLE DETAILS

Some of the debops.sysnews default variables have more extensive configuration than simple strings or lists, here you can find documentation and examples for them.

  sysnews__entries

The sysnews__*_entries lists can be used to add or manage permanent System News entries in the /var/lib/sysnews/ directory. The variables are combined in the order specified by the sysnews__combined_entries variable, entries with the same name are combined together; the entries later in the list override parameters from previous entry with the same name.

Each list entry is a YAML dictionary with specific parameters:

name
    Required. Name of the text file located in the /var/lib/sysnews/ directory (spaces if the filename are permitted).

src Optional, conflicts with content. Path to a text file located on the Ansible Controller, which should be put in the /var/lib/sysnews/ directory with a given name. By default the path is relative to the files/ directory of the debops.sysnews Ansible role.

content
    Optional, conflicts with src. YAML text block which contains a text to put in a file in the /var/lib/sysnews/ directory with a given name. The text can contain Jinja templating which will be evaluated at Ansible execution time.

state
    Optional. Define the state of a particular news file. If multiple list entries define a file state, the last one wins. Recognized states:

•   not specified or present: the file will be put in the /var/lib/sysnews/ directory.

•   absent: the specified file will be removed.

•   ignore: the given configuration entry will be ignored by the role. This can be used to conditionally activate or skip entries.

  Examples

Add a new, permanent System News entry:

sysnews__entries:
  - name: 'News about an application'
    content: |
      A new application has been installed and is ready to be used.
      Have a nice day.
    state: 'present'

AUTHOR
Maciej Delmanowski

COPYRIGHT
2014-2024, Maciej Delmanowski, Nick Janetakis, Robin Schneider and others