| defaults | ||
| meta | ||
| tasks | ||
| templates | ||
| .gitignore | ||
| LICENSE | ||
| README.md | ||
motd_management Role
This role manages the Message of the Day (MOTD) configuration by removing pre-existing MOTD scripts, deploying custom MOTD templates, and ensuring a consistent and informative MOTD display.
Description
The motd_management role provides a way to customize the Message of the Day (MOTD) on Linux systems. It dynamically removes existing MOTD scripts, deploys new ones based on provided templates, and ensures that the MOTD contains useful system information. The role is designed to be update-safe by allowing users to specify custom template directories without modifying the role itself.
Installation
- Ensure that Ansible is installed on your system. The recommended version is at least
2.17. - Clone this repository or add the role to your existing project.
- No additional dependencies are required.
Usage
Basic Example
- name: Configure MOTD
hosts: all
become: true
roles:
- motd_management
Custom Template Directory
You can specify a custom template directory to use your own MOTD templates:
- name: Configure MOTD with custom templates
hosts: all
become: true
roles:
- role: motd_management
vars:
motd_management_dir: './custom_templates/motd'
Template Structure
The role expects Jinja2 templates (.j2 files) in the template directory. By default, the role includes:
00-header.j2- Welcome header10-sysinfo.j2- System information display30-packages.j2- Package update notifications90-footer.j2- Footer information
Features
- Dynamic Template Discovery: Automatically finds and deploys all
.j2templates from the specified directory - Clean Deployment: Removes unwanted MOTD scripts and ensures only your templates are active
- Update-Safe Configuration: Uses configurable template directories to preserve custom templates during role updates
- Flexible Template Management: Supports any number of custom MOTD scripts with proper naming conventions
- Automatic Permissions: Sets executable permissions (
0755) on deployed scripts - System Integration: Removes
/etc/motdand manages/etc/update-motd.ddirectory
Configuration Variables
| Variable | Default | Description |
|---|---|---|
motd_management_dir |
{{ role_path }}/templates |
Directory containing MOTD template files |
You can override this variable in your playbook, inventory, or group/host variables.
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch for your changes.
- Submit a pull request describing your changes.
License
This project is licensed under the AGPL License. The AGPL license requires that modifications to the software be disclosed when distributed or made available over a network. For more information, see the LICENSE file.