forked from ISTI-ansible-roles/ansible-roles
Manage motd on both deb/ubuntu and centos installations.
This commit is contained in:
parent
efc0b242ba
commit
14df9121a8
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
motd_setup: True
|
||||||
|
|
||||||
|
motd_additional_text: "\nThis host runs services\n"
|
||||||
|
|
||||||
|
deb_motd_packages:
|
||||||
|
- update-notifier-common
|
||||||
|
- landscape-common
|
|
@ -0,0 +1,17 @@
|
||||||
|
---
|
||||||
|
- block:
|
||||||
|
- name: Install the packages that manage the dynamic motd file on debian based distributions
|
||||||
|
apt: pkg={{ deb_motd_packages }} state=present update_cache=yes cache_valid_time=3600
|
||||||
|
register: motd_pkgs
|
||||||
|
|
||||||
|
- name: Install our motd template file on debian based distributions
|
||||||
|
template: src=motd.j2 dest=/etc/static-motd owner=root group=root mode=0644
|
||||||
|
|
||||||
|
- name: Install the dynamic merge script of the motd file on debian based distributions
|
||||||
|
template: src=update_motd.j2 dest=/etc/update-motd.d/05-motd-message owner=root group=root mode=0755
|
||||||
|
|
||||||
|
- name: Initialise the motd prompt on debian based distributions
|
||||||
|
command: run-parts --lsbsysinit /etc/update-motd.d > /run/motd.dynamic
|
||||||
|
when: motd_pkgs is changed
|
||||||
|
|
||||||
|
tags: motd
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- import_tasks: deb_motd.yml
|
||||||
|
when: ansible_distribution_file_variety == "Debian"
|
||||||
|
|
||||||
|
- import_tasks: rh_motd.yml
|
||||||
|
when: ansible_distribution_file_variety == "RedHat"
|
|
@ -0,0 +1,6 @@
|
||||||
|
- block:
|
||||||
|
- name: Install our motd template file on RH/CentOS based distributions
|
||||||
|
template: src=motd.j2 dest=/etc/motd owner=root group=root mode=0644
|
||||||
|
|
||||||
|
tags: motd
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
{{ motd_additional_text }}
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
cat /etc/static-motd
|
||||||
|
|
||||||
|
exit 0
|
Loading…
Reference in New Issue