update_hosts.yml with motd, login page and rsyslog config

This commit is contained in:
2021-12-22 15:12:51 -05:00
parent ebae058a0b
commit 14f8936790
16 changed files with 589 additions and 5 deletions

View File

@@ -0,0 +1,18 @@
---
# update packages to latest
- name: run apt updates
apt:
upgrade: dist
update_cache: yes
cache_valid_time: 3600
when: ansible_os_family == "Debian"
- name: check for reboot required
stat:
path: /var/run/reboot-required
register: reboot_required
- name: reboot after updates
reboot:
when: reboot_required.stat.exists

View File

@@ -0,0 +1,6 @@
---
# update packages to latest
- include_tasks: apply_updates.yml
- include_tasks: motd.yml

View File

@@ -0,0 +1,38 @@
---
# main tasks for setting up motd dynamic shell header
- debug: var=ansible_nodename
- name: Install required packages
apt:
name: "{{ item }}"
update_cache: yes
cache_valid_time: 3600
state: latest
with_items:
- lsb-release
- figlet
- update-motd
- lm-sensors
when: ansible_architecture != 'armv7l'
- name: remove help text
file:
state: absent
path: "{{ item }}"
with_items:
- /etc/update-motd.d/10-help-text
- /etc/update-motd.d/51-cloudguest
when: ansible_architecture != 'armv7l'
- name: add new info
copy:
src: "{{ item.src }}"
dest: /etc/update-motd.d/{{ item.dest }}
mode: 755
with_items:
- { src: motd/hostname.sh, dest: 10-hostname }
- { src: motd/systats.sh, dest: 11-sysstats}
when: ansible_architecture != 'armv7l'