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
|
- users
|
||||||
- disks
|
- disks
|
||||||
- metacluster
|
- metacluster
|
||||||
|
- tty
|
||||||
- cleanup
|
- cleanup
|
||||||
|
@ -2,19 +2,7 @@
|
|||||||
ansible.builtin.cron:
|
ansible.builtin.cron:
|
||||||
name: firstboot
|
name: firstboot
|
||||||
state: absent
|
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
|
- name: Reboot host
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: /usr/sbin/reboot now
|
cmd: /usr/sbin/reboot now
|
||||||
|
@ -93,6 +93,7 @@
|
|||||||
# TODO: Make this list dynamic
|
# TODO: Make this list dynamic
|
||||||
- git
|
- git
|
||||||
- gitops
|
- gitops
|
||||||
|
- ingress
|
||||||
- registry
|
- registry
|
||||||
- storage
|
- storage
|
||||||
|
|
||||||
@ -133,11 +134,6 @@
|
|||||||
chdir: /opt/metacluster/container-images/
|
chdir: /opt/metacluster/container-images/
|
||||||
loop: "{{ imagetarballs.files }}"
|
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
|
- name: Configure K3s node for private registry
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
dest: /etc/rancher/k3s/registries.yaml
|
dest: /etc/rancher/k3s/registries.yaml
|
||||||
@ -334,6 +330,12 @@
|
|||||||
status_code: [200, 201]
|
status_code: [200, 201]
|
||||||
body_format: json
|
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
|
- name: Cleanup tempfile
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ kubeconfig.path }}"
|
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
|
name: cloud-init
|
||||||
state: absent
|
state: absent
|
||||||
purge: yes
|
purge: yes
|
||||||
|
|
||||||
- name: Delete cloud-init files
|
- name: Delete cloud-init files
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
|
@ -3,14 +3,17 @@
|
|||||||
name: snapd
|
name: snapd
|
||||||
state: absent
|
state: absent
|
||||||
purge: yes
|
purge: yes
|
||||||
|
|
||||||
- name: Delete leftover files
|
- name: Delete leftover files
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: /root/snap
|
path: /root/snap
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Hold snapd package
|
- name: Hold snapd package
|
||||||
ansible.builtin.dpkg_selections:
|
ansible.builtin.dpkg_selections:
|
||||||
name: snapd
|
name: snapd
|
||||||
selection: hold
|
selection: hold
|
||||||
|
|
||||||
- name: Reload systemd unit configurations
|
- name: Reload systemd unit configurations
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
|
@ -4,8 +4,11 @@
|
|||||||
regexp: "{{ item.regexp }}"
|
regexp: "{{ item.regexp }}"
|
||||||
line: "{{ item.line }}"
|
line: "{{ item.line }}"
|
||||||
loop:
|
loop:
|
||||||
- { regexp: '^#NAutoVTs=', line: 'NAutoVTs=1'}
|
- regexp: '^#NAutoVTs='
|
||||||
- { regexp: '^#ReserveVT=', line: 'ReserveVT=11'}
|
line: 'NAutoVTs=1'
|
||||||
|
- regexp: '^#ReserveVT='
|
||||||
|
line: 'ReserveVT=11'
|
||||||
|
|
||||||
- name: Mask getty@tty1 service
|
- name: Mask getty@tty1 service
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: getty@tty1
|
name: getty@tty1
|
||||||
|
Loading…
Reference in New Issue
Block a user