Getting started

Default configuration

By default, the role will remove an existing /etc/motd file to move the original Debian/Ubuntu MOTD out of the way. This can be controlled using the machine__etc_motd_state variable. The original version of the file is maintained by the base-files package and can be found in the /usr/share/base-files/motd file.

You can use the /etc/motd.tail file to include manual text in the dynamic MOTD. Alternatively, you can put a custom script in the /etc/update-motd.d/ directory.

You can use the debops.resources Ansible role to install multiple custom scripts in the /etc/update-motd.d/ directory at once by copying them from the resources/ subdirectory on the Ansible Controller.

Ansible local facts

The debops.machine role provides a set of Ansible local facts available in the ansible_local.machine.* hierarchy. They will contain contents of the /etc/machine-info variables, so that they could be used by other Ansible roles when configured.

Example inventory

The debops.machine role is included by default in the common.yml DebOps playbook; you don't need to add hosts to any Ansible groups to enable it.

Example playbook

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

---

- name: Manage local machine information
  hosts: [ 'debops_all_hosts', 'debops_service_machine' ]
  become: True

  environment: '{{ inventory__environment | d({})
                   | combine(inventory__group_environment | d({}))
                   | combine(inventory__host_environment  | d({})) }}'

  roles:

    - role: debops.machine
      tags: [ 'role::machine', 'skip::machine' ]

Ansible tags

You can use Ansible --tags or --skip-tags parameters to limit what tasks are performed during Ansible run. This can be used after a host was first configured to speed up playbook execution, when you are sure that most of the configuration is already in the desired state.

Available role tags:

role::machine
Main role tag, should be used in the playbook to execute all of the role tasks as well as role dependencies.