I assume this is an ordinary server, behind a router or switch that then connects to the internet. I'd rename the 50-cloud-init.yaml file:
sudo mv /etc/netplan/50-cloud-init.yaml /etc/netplan/01-netcfg.yaml
Then find out the relevant interface name:
ifconfig
Assuming, for an example, that your relevant interface is enp0s25, edit the file:
sudo nano /etc/netplan/01-netcfg.yaml
Amend the file to read:
network:
version: 2
renderer: networkd
ethernets:
enp0s25:
addresses: [192.168.100.40/22]
gateway4: 192.168.100.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
Of course, substitute your exact details here. Spacing, indentation, etc. are crucial. Proofread carefully. Save (Ctrl+O followed by Enter) and close (Ctrl+X) the text editor.
Next:
sudo netplan apply
sudo ip link set enp0s25 down
sudo ip link set enp0s25 up
Did you get the requested IP address?
ip addr show
Can you ping?
ping -c3 8.8.8.8
ping -c3 www.ubuntu.com
If you get ping returns, you are all set.