maas-autobuilder/user-data.yaml

54 lines
1.3 KiB
YAML

#cloud-config
ssh_import_id:
- lp:arif-ali
## Update apt database and upgrade packages on first boot
package_update: true
package_upgrade: true
users:
- default
- name: virsh
primary_group: virsh
passwd: $6$SVOxUrhz9mNyscUJ$hKF0RMY1nkGC3BpiozpaznE3AWerd8Ac8AlV9YEpLx50bLw5zweFCuTEEdS04McJNlaIqA.E4HiPuaIYGMzlH/
lock_passwd: false
## Install additional packages on first boot
packages:
- virtinst
- bc
- jq
- qemu-kvm
- libvirt-bin
- qemu-efi
- ksmtuned
## Write arbitrary files to the file-system (including binaries!)
write_files:
- path: /root/initial_setup.sh
content: |
#!/bin/bash
# Enable SSH, so that virsh can login
sed -i "s/^\(PasswordAuthentication\).*/\1 yes/g" /etc/ssh/sshd_config
systemctl restart sshd
git clone https://github.com/arif-ali/maas-autobuilder.git /root/maas-autobuilder
cd /root/maas-autobuilder
ln -sf ${HOSTNAME}.config hypervisor.config
chmod +x manage-maas-nodes.sh
./manage-maas-nodes.sh -c
permissions: '0755'
owner: root:root
# Runs any command that we need to run post install
runcmd:
- [ "efibootmgr", "-n", "0001"]
- [ "usermod", "-a", "-G", "libvirt", "virsh" ]
- [ "usermod", "-a", "-G", "libvirt-qemu", "virsh" ]
- [ "systemctl", "enable", "ksmtuned"]
- [ "systemctl", "restart", "ksmtuned"]
- [ "/root/initial_setup.sh" ]