jtyr.motd
motd
Ce rôle crée le fichier Message Of The Day (motd) avec quelques informations supplémentaires sur la distribution et le matériel.
La configuration du rôle est conçue de telle manière qu'il n'est pas nécessaire de modifier le rôle pour effectuer une configuration quelconque. Tout peut être réalisé en changeant les paramètres du rôle ou en déclarant une nouvelle configuration comme variable. Cela rend ce rôle absolument universel. Voir les exemples ci-dessous pour plus de détails.
Veuillez signaler tout problème ou envoyer une demande de tirage (PR).
Exemple
# Ceci est un exemple de liste
- host: monhôte
# Charge le rôle pour produire le fichier /etc/motd
roles:
- motd
Ce playbook produit le fichier `/etc/motd' ressemblant à ceci :
[root@localhost ~]# cat /etc/motd
_ _ _ _
/ \ _ __ ___(_) |__ | | ___
/ _ \ | '_ \/ __| | '_ \| |/ _ \
/ ___ \| | | \__ \ | |_) | | __/
/_/ \_\_| |_|___/_|_.__/|_|\___|
FQDN : localhost.localdomain
Distribution : CentOS 6.6 Final
Virtuel : OUI
CPUs : 1
RAM : 0.49GB
Variables du rôle
# Art ASCII par défaut affiché au début du motd
motd_ascii_art: |-2
_ _ _ _
/ \ _ __ ___(_) |__ | | ___
/ _ \ | '_ \/ __| | '_ \| |/ _ \
/ ___ \| | | \__ \ | |_) | | __/
/_/ \_\_| |_|___/_|_.__/|_|\___|
# Que faut-il cacher l'information Virtuel
motd_hide_virtual: non
# Que faut-il ajouter une nouvelle ligne après l'information Virtuel
motd_virtual_newline: oui
# Nombre d'espaces initiaux
motd_initial_spaces: 1
# Taille d'indentation
motd_indent: "{{ 7 if motd_hide_virtual else 8 }}"
# Informations par défaut à afficher sous l'art ASCII
motd_info__default:
- FQDN: "{{ ansible_facts.fqdn }}"
- Distribution: "{{ ansible_facts.distribution }} {{ ansible_facts.distribution_version }} {{ ansible_facts.distribution_release }}"
- "{{
{ '': ' ' if motd_virtual_newline else '' }
if motd_hide_virtual
else
{ 'Virtuel': ('OUI\n' if motd_virtual_newline else 'OUI') if ansible_facts.virtualization_role == 'guest' else ('NON\n' if motd_virtual_newline else 'NON') } }}"
- CPUs: "{{ ansible_facts.processor_vcpus }}"
- RAM: "{{ (ansible_facts.memtotal_mb / 1000) | round(1) }}GB"
# Informations personnalisées à afficher sous l'art ASCII
motd_info__custom: []
# Informations finales à afficher sous l'art ASCII
motd_info: "{{
motd_info__default +
motd_info__custom
}}"
Licence
MIT
Auteur
Jiri Tyr