Housekeeping;Add tty console message
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
05e0c50217
commit
96dccef450
@ -11,4 +11,5 @@
|
||||
- users
|
||||
- disks
|
||||
- metacluster
|
||||
- tty
|
||||
- cleanup
|
||||
|
@ -2,19 +2,7 @@
|
||||
ansible.builtin.cron:
|
||||
name: firstboot
|
||||
state: absent
|
||||
- name: Restore extra tty
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/systemd/logind.conf
|
||||
regexp: "{{ item.regexp }}"
|
||||
line: "{{ item.line }}"
|
||||
loop:
|
||||
- { regexp: '^NAutoVTs=', line: '#NAutoVTs=6'}
|
||||
- { regexp: '^ReserveVT=', line: '#ReserveVT=6'}
|
||||
- name: Unmask getty@tty1 service
|
||||
ansible.builtin.systemd:
|
||||
name: getty@tty1
|
||||
enabled: yes
|
||||
masked: no
|
||||
|
||||
- name: Reboot host
|
||||
ansible.builtin.shell:
|
||||
cmd: /usr/sbin/reboot now
|
||||
|
@ -93,6 +93,7 @@
|
||||
# TODO: Make this list dynamic
|
||||
- git
|
||||
- gitops
|
||||
- ingress
|
||||
- registry
|
||||
- storage
|
||||
|
||||
@ -133,11 +134,6 @@
|
||||
chdir: /opt/metacluster/container-images/
|
||||
loop: "{{ imagetarballs.files }}"
|
||||
|
||||
- name: Delete container image tarballs/archives
|
||||
ansible.builtin.file:
|
||||
path: /opt/metacluster/container-images
|
||||
state: absent
|
||||
|
||||
- name: Configure K3s node for private registry
|
||||
ansible.builtin.template:
|
||||
dest: /etc/rancher/k3s/registries.yaml
|
||||
@ -334,6 +330,12 @@
|
||||
status_code: [200, 201]
|
||||
body_format: json
|
||||
|
||||
- name: Delete container image tarballs/archives
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: absent
|
||||
with_fileglob: /opt/metacluster/container-images/*.tar
|
||||
|
||||
- name: Cleanup tempfile
|
||||
ansible.builtin.file:
|
||||
path: "{{ kubeconfig.path }}"
|
||||
|
@ -0,0 +1,20 @@
|
||||
- name: Create folder structure(s)
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
loop:
|
||||
- /opt/firstboot
|
||||
|
||||
- name: Save tty script file
|
||||
ansible.builtin.template:
|
||||
src: tty.j2
|
||||
dest: /opt/firstboot/tty.sh
|
||||
user: root
|
||||
group: root
|
||||
mode: 0700
|
||||
|
||||
- name: Create @reboot crontab job
|
||||
ansible.builtin.cron:
|
||||
name: tty.consolemessage
|
||||
special_time: reboot
|
||||
job: /opt/firstboot/tty.sh
|
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
export TERM=linux
|
||||
|
||||
BGRN='\033[1;92m'
|
||||
BGRY='\033[1;30m'
|
||||
BBLU='\033[1;34m'
|
||||
BRED='\033[1;91m'
|
||||
BWHI='\033[1;97m'
|
||||
CBLA='\033[?16;0;30cm' # Hide blinking cursor
|
||||
DFLT='\033[1;0m' # Reset colour
|
||||
LCLR='\033[K' # Clear to end of line
|
||||
PRST='\033[1;92m' # Reset cursor position
|
||||
|
||||
COMPONENTS=('ingress' 'storage' 'registry' 'git' 'gitops')
|
||||
FQDN='{{ vapp['metacluster.fqdn'] }}'
|
||||
IPADDRESS='{{ vapp['guestinfo.ipaddres'] }}'
|
||||
|
||||
clear > /dev/tty1
|
||||
|
||||
while /bin/true; do
|
||||
echo -e "${PRST}" > /dev/tty1
|
||||
echo -e "\n\n\t${DFLT}To manage this appliance, please connect to one of the following:${LCLR}\n" > /dev/tty1
|
||||
|
||||
for comp in "${COMPONENTS}"; do
|
||||
STATUS=$(curl -ks "https://${comp}.${FQDN}" -o /dev/null -w '%{http_code}')
|
||||
|
||||
if [[ "${STATUS}" -eq "200" ]]; then
|
||||
echo -e "\t [${BGRN}+${DFLT}] ${BBLU}https://${comp}.${FQDN}${DFLT}${LCLR}" > /dev/tty1
|
||||
else
|
||||
echo -e "\t [${BRED}-${DFLT}] ${BBLU}https://${comp}.${FQDN}${DFLT}${LCLR}" > /dev/tty1
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e "\n\t${BGRY}Note that your DNS zone ${DFLT}must have ${BGRY} respective records defined, each pointing to:${DFLT}${LCLR}" > /dev/tty1
|
||||
echo -e "\t${BGRY} - ${DFLT}${IPADDRESS}${LCLR}" > /dev/tty1
|
||||
|
||||
echo -e "${CBLA}" > /dev/tty1
|
||||
sleep 1
|
||||
done
|
@ -3,6 +3,7 @@
|
||||
name: cloud-init
|
||||
state: absent
|
||||
purge: yes
|
||||
|
||||
- name: Delete cloud-init files
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
|
@ -3,14 +3,17 @@
|
||||
name: snapd
|
||||
state: absent
|
||||
purge: yes
|
||||
|
||||
- name: Delete leftover files
|
||||
ansible.builtin.file:
|
||||
path: /root/snap
|
||||
state: absent
|
||||
|
||||
- name: Hold snapd package
|
||||
ansible.builtin.dpkg_selections:
|
||||
name: snapd
|
||||
selection: hold
|
||||
|
||||
- name: Reload systemd unit configurations
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: yes
|
||||
|
@ -4,8 +4,11 @@
|
||||
regexp: "{{ item.regexp }}"
|
||||
line: "{{ item.line }}"
|
||||
loop:
|
||||
- { regexp: '^#NAutoVTs=', line: 'NAutoVTs=1'}
|
||||
- { regexp: '^#ReserveVT=', line: 'ReserveVT=11'}
|
||||
- regexp: '^#NAutoVTs='
|
||||
line: 'NAutoVTs=1'
|
||||
- regexp: '^#ReserveVT='
|
||||
line: 'ReserveVT=11'
|
||||
|
||||
- name: Mask getty@tty1 service
|
||||
ansible.builtin.systemd:
|
||||
name: getty@tty1
|
||||
|
Loading…
Reference in New Issue
Block a user