mirror of
https://github.com/KevinMidboe/playbooks-retailor.git
synced 2026-01-06 01:15:45 +00:00
ansible playbooks for retailor.io infrastructure
This commit is contained in:
69
roles/motd/tasks/main.yml
Normal file
69
roles/motd/tasks/main.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
---
|
||||
- name: create motd-hostname file
|
||||
file:
|
||||
path: /etc/update-motd.d/20-hostname
|
||||
state: touch
|
||||
|
||||
- name: download motd executable from github.com
|
||||
command: curl -o /usr/local/bin/motd https://raw.githubusercontent.com/kevinmidboe/motdGO/main/motd-linux creates=/usr/local/bin/motd
|
||||
|
||||
- name: set motd executable permission
|
||||
file:
|
||||
path: /usr/local/bin/motd
|
||||
mode: +x
|
||||
|
||||
- name: generate motd-hostname from motd executable
|
||||
command: motd -font larry3d -str {{ inventory_hostname }} -parser motd
|
||||
register: motd_hostname
|
||||
|
||||
- name: write command output to 20-hostname file
|
||||
copy:
|
||||
content: "{{ motd_hostname.stdout }}"
|
||||
dest: /etc/update-motd.d/20-hostname
|
||||
|
||||
- name: set motd-hostname executable permission
|
||||
file:
|
||||
path: /etc/update-motd.d/20-hostname
|
||||
mode: +x
|
||||
|
||||
- name: generate motd-abstract
|
||||
template:
|
||||
src: 25-abstract.j2
|
||||
dest: /etc/update-motd.d/25-abstract
|
||||
owner: root
|
||||
group: root
|
||||
mode: +x
|
||||
when: description
|
||||
|
||||
- name: check if help-text motd exists
|
||||
stat:
|
||||
path: /etc/update-motd.d/10-help-text
|
||||
register: help_text
|
||||
|
||||
- name: disable help-text motd
|
||||
file:
|
||||
path: /etc/update-motd.d/10-help-text
|
||||
mode: -x
|
||||
when: help_text.stat.exists == true
|
||||
|
||||
- name: check if motd-news motd exists
|
||||
stat:
|
||||
path: /etc/update-motd.d/50-motd-news
|
||||
register: motd_news
|
||||
|
||||
- name: disable motd-news motd
|
||||
file:
|
||||
path: /etc/update-motd.d/50-motd-news
|
||||
mode: -x
|
||||
when: motd_news.stat.exists == true
|
||||
|
||||
- name: check if unminimize motd exists
|
||||
stat:
|
||||
path: /etc/update-motd.d/60-unminimize
|
||||
register: motd_unminimize
|
||||
|
||||
- name: disable unminimize motd
|
||||
file:
|
||||
path: /etc/update-motd.d/60-unminimize
|
||||
mode: -x
|
||||
when: motd_unminimize.stat.exists == true
|
||||
Reference in New Issue
Block a user