-- Network setup
----------------

nmcli connection show --active

nmcli connection modify enp4s0 ipv4.address 192.168.0.4/24
nmcli connection modify enp4s0 ipv4.method manual ipv6.method ignore
nmcli connection modify enp4s0 ipv4.gateway 192.168.0.1
nmcli connection modify enp4s0 ipv4.dns 192.168.0.8
nmcli connection modify enp4s0 ipv4.dns-search swgalaxy

hostnamectl set-hostname naboo.swgalaxy

# SELINUX=disabled
/etc/selinux/config

systemctl stop firewalld
systemctl disable firewalld

-- KVM install
--------------

dnf install -y qemu-kvm libvirt virt-manager virt-install virtio-win.noarch
dnf install -y epel-release -y
dnf -y install bridge-utils virt-top libguestfs-tools bridge-utils virt-viewer 
dnf -y install at wget bind-utils

systemctl start atd
systemctl enable atd
systemctl status atd

lsmod | grep kvm

systemctl start libvirtd
systemctl enable libvirtd

brctl show
nmcli connection show 

# This section should be scripted and run from the server console or run under at-script as background command
#---->

export BR_NAME="br0"
export BR_INT="enp4s0"
export SUBNET_IP="192.168.0.4/24"
export GW="192.168.0.1"
export DNS1="192.168.0.8"

nmcli connection add type bridge autoconnect yes con-name ${BR_NAME} ifname ${BR_NAME}

nmcli connection modify ${BR_NAME} ipv4.addresses ${SUBNET_IP} ipv4.method manual
nmcli connection modify ${BR_NAME} ipv4.gateway ${GW}
nmcli connection modify ${BR_NAME} ipv4.dns ${DNS1}

nmcli connection delete ${BR_INT}
nmcli connection add type bridge-slave autoconnect yes con-name ${BR_INT} ifname ${BR_INT} master ${BR_NAME}

nmcli connection show 
nmcli connection up br0
nmcli connection show br0

ip addr show

systemctl restart libvirtd
# <-----


# Install other stuff: Cockpit, bind-utils, cifs-utils etc.
dnf install cockpit cockpit-machines.noarch -y

systemctl start cockpit
systemctl enable --now cockpit.socket

# reboot the system

dnf install -y lsof bind-utils cifs-utils.x86_64

# setup CIFS mounts
groupadd smbuser --gid 1502
useradd smbuser --uid 1502 -g smbuser -G smbuser

-- create credentials file for automount: /root/.smbcred
username=vplesnila
password=*****

mkdir -p /mnt/yavin4
mkdir -p /mnt/unprotected

-- add in /etc/fstab
//192.168.0.9/share   /mnt/yavin4   cifs  vers=3.0,uid=smbuser,gid=smbuser,file_mode=0775,dir_mode=0775,credentials=/root/.smbcred,mfsymlinks,iocharset=utf8  0 0
//192.168.0.9/unprotected   /mnt/unprotected   cifs  vers=3.0,uid=smbuser,gid=smbuser,file_mode=0775,dir_mode=0775,credentials=/root/.smbcred,mfsymlinks,iocharset=utf8  0 0

systemctl daemon-reload
mount -a

