Headline:
Make it possible to add extra cloud-init lines to the lines Morpheus already uses
Description:
In running cloud-init there is a great way of adjusting the OS image to the deployment of the VM it becomes.
Currently Morpheus allows to adjust “user-data” a.k.a. runcmds: from the cloud-init setup.
We propose to have all the cloud-init fields to have adjustable config (or added config).
Why?
- when trying to only have static IP addresses in Linux every Linux distro has it’s own ways and Morpheus doesn’t currently (5.5.3/6.0.5) allow to adjust the “files” part of your cloud-init in which with the powerfull Morpheus templates you could craft all the necessary adjustments.
- allowing to add lines to the “files” part could make life easier in setups which need to be there in different parts of clouds without the need to have different images for the same virtualization but different clouds (for instance your DNF/YUM/APT repositories)
- allowing to adjust the cloud-init on other parts allows to adjust partitions, LVMs (all parts of which make cloud-init great
Example/Use case(s):
As an example an working cloud-init for static IP assignment and correct config of DNF repositories for an RHEL based image, which circumvents the need for DHCP in a Linux image to get the static IP assignment from Morpheus
#cloud-config
# 1vCPU, 4 cores, 12 GB vMEM, 120GB disk, VLAN xxx
fqdn: xxx.xxx.nl
ssh_pwauth: true
chpasswd: false
users:
- name: ansible
sudo: ['ALL=(ALL) NOPASSWD:ALL']
lock-passwd: false
groups: wheel, users
passwd: $6$.....
write_files:
- path: /etc/sysconfig/network-scripts/ifcfg-eth0
content: |
# Static IP Configured
DEVICE=eth0
TYPE=Ethernet
BOOTPROTO=static
STARTMODE=auto
IPADDR=a.b.c.d
NETMASK=255.255.255.0
GATEWAY=a.b.c.1
ONBOOT=yes
DOMAIN=xxx.nl
DNS1=a.b.c.x
- path: /etc/sysconfig/network
content: |
NETWORKING=yes
NETWORKING_IPV6=no
#IPv6 Must be enabled soon
- path: /etc/yum.repos.d/appstream.repo
content: |
[Appstream]
baseurl=http://a.b.c.y/repos/RedHat/8/rhel-8-for-x86_64-appstream-rpms
enabled=true
gpgcheck=false
name=Red Hat Enterprise Linux 8.7.0 Appstream
metadata_expire=-1
- path: /etc/yum.repos.d/baseos.repo
content: |
[BaseOS]
baseurl=http://a.b.c.y/repos/RedHat/8/rhel-8-for-x86_64-baseos-rpms
enabled=true
gpgcheck=false
name=Red Hat Enterprise Linux 8.7.0 BaseOS
metadata_expire=-1
runcmd:
- rm -rf /etc/ssh/ssh_host_* /etc/machine-id
- systemd-machine-id-setup
- systemctl restart NetworkManager
- /usr/libexec/openssh/sshd-keygen rsa
- /usr/libexec/openssh/sshd-keygen ecdsa
- /usr/libexec/openssh/sshd-keygen ed25519
- systemctl restart sshd
- touch /etc/cloud/cloud-init.disabled
- sudo reboot