From f59f1dc5cd2d5efcca8865b78baa1a4dfc805d84 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Fri, 29 Dec 2023 17:43:18 +0100 Subject: [PATCH] Add MOTD --- inventory.ini | 10 +++++----- roles/virt-common/tasks/main.yml | 7 +++++++ roles/virt-common/templates/motd.j2 | 9 +++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 roles/virt-common/templates/motd.j2 diff --git a/inventory.ini b/inventory.ini index cf8a143..26cdf75 100644 --- a/inventory.ini +++ b/inventory.ini @@ -19,8 +19,8 @@ sapt-labs-db01 [proxy_shrd] sapt-labr-prx01 -[monitor_shrd] -sapt-labr-mon01 +# [monitor_shrd] +# sapt-labr-mon01 [proxmox_infra] sapt-labx-pve01 @@ -40,7 +40,7 @@ db_stage [shared:children] proxy_shrd -monitor_shrd +# monitor_shrd [appservers:children] app_prod @@ -57,8 +57,8 @@ db_stage [proxyservers:children] proxy_shrd -[monitorservers:children] -monitor_shrd +# [monitorservers:children] +# monitor_shrd [virtualservers:children] production diff --git a/roles/virt-common/tasks/main.yml b/roles/virt-common/tasks/main.yml index 780b722..a658bb7 100644 --- a/roles/virt-common/tasks/main.yml +++ b/roles/virt-common/tasks/main.yml @@ -8,6 +8,13 @@ owner: root mode: u=rw,g=r,o=r +- name: Copy MOTD file + ansible.builtin.template: + src: motd.j2 + dest: /etc/motd.d/10-ansible + owner: root + mode: u=rw,g=r,o=r + - name: Add users ansible.builtin.user: name: "{{ item.name }}" diff --git a/roles/virt-common/templates/motd.j2 b/roles/virt-common/templates/motd.j2 new file mode 100644 index 0000000..460276c --- /dev/null +++ b/roles/virt-common/templates/motd.j2 @@ -0,0 +1,9 @@ + + Welcome to {{ hostname }}! +=========================================================================== + - FQDN................: {{ fqdn }} + - LAN IPv4............: {{ ansible_host }} + - Internal IPv4.......: {{ internal_ipv4 }} + - Server type.........: {{ virt_type | upper }} +=========================================================================== +