addef motd configuration using figlet

This commit is contained in:
2026-01-05 22:54:55 +01:00
parent 90329647fc
commit cca1c7c5da
4 changed files with 28 additions and 0 deletions

12
motd.yml Normal file
View File

@@ -0,0 +1,12 @@
---
- hosts: all
become: true
tasks:
- name: Import related variables
ansible.builtin.include_vars:
file: figlet.yml
- import_tasks: tasks/debian-general/update.yml
when: ansible_facts['distribution'] == 'Debian'
- import_tasks: tasks/rhel-general/update.yml
when: ansible_facts['distribution'] == 'RedHat'
- import_tasks: tasks/general/figlet.yml

9
tasks/general/figlet.yml Normal file
View File

@@ -0,0 +1,9 @@
---
- name: Ensure figlet is installed
ansible.builtin.package:
name: figlet
state: latest
- name: Ensure motd is configured using figlet
ansible.builtin.shell: |
figlet -f small "{{ FIGLET_NAME }}" | sed 's/[[:blank:]]*$//' | tee /etc/motd | tail -n 1 | grep -q -P '^$' || echo >> /etc/motd

View File

@@ -0,0 +1,5 @@
---
- name: Ensure RHEL has updated cache
ansible.builtin.dnf:
update_cache: yes
cache_valid_time: 0

2
vars/figlet.yml Normal file
View File

@@ -0,0 +1,2 @@
---
FIGLET_NAME: zigbee2mqtt