Last active
November 10, 2024 16:36
-
-
Save ironwolphern/0e1e978a367bed22d99ee2a170aa8391 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
hostname: podman | |
fqdn: podman.example.com | |
manage_etc_hosts: true | |
# Users and Groups | |
users: | |
- name: usuario | |
sudo: ALL=(ALL) NOPASSWD:ALL | |
groups: adm, sudo | |
home: /home/usuario | |
shell: /bin/bash | |
lock_passwd: true | |
uid: 1000 | |
ssh-authorized-keys: | |
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0WGP1EZfreNQSJWjV/Fant... | |
# Package Management | |
package_reboot_if_required: true | |
package_update: true | |
package_upgrade: true | |
packages: | |
- vim | |
- net-tools | |
- curl | |
- wget | |
- lolcat | |
- figlet | |
- git | |
- jq | |
- cron | |
- default-jre | |
- qemu-guest-agent | |
# Custom Files | |
write_files: | |
- path: /etc/update-motd.d/01-custom-logo | |
permissions: '0755' | |
content: | | |
#!/bin/bash | |
# This script print a banner with logo and system information. | |
# Need two packages: figlet and lolcat | |
# Fix: for lolcat to work properly, you have to move the binary from /usr/games/lolcat to /usr/bin/lolcat | |
# Colors | |
GREEN='\033[0;32m' | |
BLUE='\033[0;34m' | |
YELLOW='\033[0;33m' | |
NC='\033[0m' | |
LOGO='Example' | |
MESSAGE='Example message' | |
# Banner | |
figlet -w 70 -f slant -c "${LOGO}" | lolcat -f | |
printf " Welcome to ${LOGO}'s %s Server" "$(hostname -s)" | lolcat -f | |
echo | |
echo | |
# Sysrem Information | |
printf " ${YELLOW}System Information at:${NC} ${GREEN}%s${NC}\n" "$(date)" | |
echo | |
printf "${YELLOW}System Load:\t${NC}${BLUE}%s${NC}\t\t${YELLOW}Processes:\t${BLUE}%s${NC}\n" "$(cat /proc/loadavg | awk '{print $1, $2, $3}')" "$(ps aux --no-headings | wc -l)" | |
printf "${YELLOW}Memory Usage:\t${NC}${BLUE}%s${NC}\t${YELLOW}IP Address:\t${BLUE}%s${NC}\n" "$(free -m | awk 'NR==2{printf "%s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }')" "$(hostname -I | awk '{print $1}')" | |
printf "${YELLOW}Disk Usage:\t${NC}${BLUE}%s${NC}\t\t${YELLOW}System Uptime:\t${BLUE}%s${NC}\n" "$(df -h / | awk 'NR==2{printf "%s/%s (%s)\n", $3,$2,$5}')" "$(uptime -p)" | |
# Banner 2 | |
echo | |
echo " ${LOGO} - ${MESSAGE}" | lolcat -f | |
echo | |
# Run Commands | |
runcmd: | |
- mv /usr/games/lolcat /usr/bin/lolcat | |
- chmod -x /etc/update-motd.d/* | |
- chmod +x /etc/update-motd.d/01-custom-logo | |
- sed -i 's/#Banner none/Banner none/g' /etc/ssh/sshd_config | |
- sed -i 's/#PrintLastLog yes/PrintLastLog no/g' /etc/ssh/sshd_config | |
- sed -i 's/session optional pam_motd.so noupdate/# session optional pam_motd.so noupdate/g' /etc/pam.d/login | |
- systemctl restart ssh | |
- systemctl start qemu-guest-agent | |
- apt-get install -y unattended-upgrades | |
- dpkg-reconfigure -f noninteractive unattended-upgrades | |
- timedatectl set-timezone Europe/Madrid | |
- apt-get install -y podman | |
- apt-get install -y python3-pip python3-dotenv | |
- curl -o /usr/local/bin/podman-compose https://raw.githubusercontent.com/containers/podman-compose/main/podman_compose.py | |
- chmod +x /usr/local/bin/podman-compose |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
ethernets: | |
ens18: | |
dhcp4: true | |
dhcp6: false | |
optional: true | |
# Configuración estática (comentada) | |
# addresses: | |
# - 192.168.1.100/24 | |
# gateway4: 192.168.1.1 | |
# nameservers: | |
# search: [example.com] | |
# addresses: [8.8.8.8, 8.8.4.4] | |
# routes: | |
# - to: 0.0.0.0/0 | |
# via: 10.23.2.1 | |
# metric: 3 | |
# ens19: | |
# dhcp4: false | |
# dhcp6: false | |
# optional: true | |
# addresses: | |
# - 10.0.0.10/24 | |
# Ejemplo de configuración de bonding | |
# bonds: | |
# bond0: | |
# interfaces: [ens18, ens19] | |
# addresses: [192.168.1.100/24] | |
# gateway4: 192.168.1.1 | |
# nameservers: | |
# addresses: [8.8.8.8, 8.8.4.4] | |
# parameters: | |
# mode: active-backup | |
# primary: ens18 | |
# Ejemplo de configuración de VLAN | |
# vlans: | |
# vlan15: | |
# id: 15 | |
# link: ens18 | |
# addresses: [10.0.15.10/24] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment