Move the linux_kvm stuff to a script

This commit is contained in:
Arif Ali 2020-12-27 17:40:02 +00:00
parent 40694207a3
commit 174aeb558d
Signed by: arif
GPG Key ID: 369608FBA1353A70
2 changed files with 8 additions and 7 deletions

View File

@ -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

View File

@ -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"]