addef motd configuration using figlet
This commit is contained in:
12
motd.yml
Normal file
12
motd.yml
Normal 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
9
tasks/general/figlet.yml
Normal 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
|
||||
5
tasks/rhel-general/update.yml
Normal file
5
tasks/rhel-general/update.yml
Normal 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
2
vars/figlet.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
FIGLET_NAME: zigbee2mqtt
|
||||
Reference in New Issue
Block a user