Quantcast
Channel: Ubuntu Forums - Virtualisation
Viewing all articles
Browse latest Browse all 4211

network config (static IP) via cloud-init

$
0
0
I've googled this to hell and back and attempted to read the official cloud-init documentation but no dice... (the documentation is ALL OVER THE PLACE)

I'm simply trying to set a static IP via cloud-init.

I'm starting with a VM which I clone after issuing
Code:

sudo cloud-init clean.
After that I make the ISO and attach it to the CD-ROM.

Code:

cloud-localds -N network-config.yml xenial-user-data.img user-data.yml
meta-data.yml
Code:

dsmode: local
user-data.yml
Code:

#cloud-config
# Hostname management
preserve_hostname: False
hostname: testvm-linux
fqdn: testvm-linux.xxxxxxxx.com
 
# Setup Users with ssh keys so that I can log in into new machine
users:
    - default
    - name: xxxxxxxx
      groups: ['wheel','sudo']
      shell: /bin/bash
      sudo: ALL=(ALL) ALL
      lock_passwd: False
      passwd: xxxxxxxx
      ssh-authorized-keys:
        - ssh-rsa xxxxxxxxx

# Configure where output will go
output:
  all: ">> /var/log/cloud-init.log"
 
# configure interaction with ssh server
ssh_genkeytypes: ['ed25519', 'rsa']
 
 
# set timezone for VM
timezone: xxx/xxx
 
# Reset network
runcmd:
  - systemctl stop network && systemctl start network

network-config.yml
Code:

version: 2
ethernets:
  ens3:
    addresses:
      - 192.168.0.101/24
    gateway4: 192.168.0.1
    nameservers:
      search: [xxxxxx.com]
      addresses: [8.8.8.8]

Just does nothing. I still end up with DHCP and only a single file in /etc/netplan which is 01-network-manager-all.yaml

I've read these threads too and I'm doing all their 'fixes'
https://gist.github.com/Informatic/0...b9d25595cdbd47
https://gist.github.com/itzg/2577205...bd876ae458e18e

What am I doing wrong???

Viewing all articles
Browse latest Browse all 4211

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>