From 174aeb558d26f4fbbb2f987cc2b1ceccfa582a7e Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Sun, 27 Dec 2020 17:40:02 +0000 Subject: [PATCH] Move the linux_kvm stuff to a script --- manage-hypervisor-nodes.sh | 2 +- user-data.yaml | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manage-hypervisor-nodes.sh b/manage-hypervisor-nodes.sh index 6854e79..501ac4e 100755 --- a/manage-hypervisor-nodes.sh +++ b/manage-hypervisor-nodes.sh @@ -34,7 +34,7 @@ maas_assign_networks() vlan_int=$(maas ${maas_profile} interfaces create-vlan ${system_id} vlan=${maas_vlan_id} parent=$phys_int_id) vlan_int_id=$(echo $vlan_int | jq .id | sed s/\"//g) if [[ $vlan -eq $external_vlan ]] ; then - # Set the external IP to be static as per the configuration + # Set the external IP to be static as per the configuration mode="STATIC" ip_addr="ip_address=$external_ip" else diff --git a/user-data.yaml b/user-data.yaml index dded3e1..a2bf225 100644 --- a/user-data.yaml +++ b/user-data.yaml @@ -41,10 +41,14 @@ write_files: ./manage-maas-nodes.sh -c permissions: '0755' owner: root:root -- path: /root/update_sshd.sh +- path: /root/linux_kvm.sh content: | #!/bin/bash + mkdir -p /home/virsh/bin + ln -s /usr/bin/virsh /home/virsh/bin/virsh + sh -c echo "PATH=/home/virsh/bin" >> /home/virsh/.bashrc + cat >> /etc/ssh/sshd_config << EOF Match user virsh X11Forwarding no @@ -58,11 +62,8 @@ write_files: # Runs any command that we need to run post install runcmd: - - [ "mkdir", "-p", "/home/virsh/bin" ] - - [ "ln", "-s", "/usr/bin/virsh", "/home/virsh/bin/virsh" ] - - [ "sh", "-c", 'echo "PATH=/home/virsh/bin" >> /home/virsh/.bashrc' ] - - [ "/root/update_sshd.sh" ] - - [ "rm", "/root/update_sshd.sh" ] + - [ "/root/linux_kvm.sh" ] + - [ "rm", "/root/linux_kvm.sh" ] - [ "usermod", "-a", "-G", "libvirt", "virsh" ] - [ "usermod", "-a", "-G", "libvirt-qemu", "virsh" ] - [ "efibootmgr", "-n", "0001"]