Move the sshd_config stuff to a script

This commit is contained in:
2020-12-26 09:50:10 +00:00
parent cd550ec378
commit f9ba912164
3 changed files with 18 additions and 12 deletions

View File

@@ -1 +1 @@
asrock02.config
asrock01.config

View File

@@ -157,6 +157,7 @@ destroy_node() {
maas ${maas_profile} pod delete ${pod_id}
system_id=$(maas_system_id ${hypervisor_name})
maas ${maas_profile} machine release ${system_id}
maas ${maas_profile} machine delete ${system_id}
}

View File

@@ -41,25 +41,30 @@ write_files:
./manage-maas-nodes.sh -c
permissions: '0755'
owner: root:root
- path: /root/update_sshd.sh
content: |
#!/bin/bash
cat >> /etc/ssh/sshd_config << EOF
Match user virsh
X11Forwarding no
AllowTcpForwarding no
PermitTTY no
ForceCommand nc -q 0 -U /var/run/libvirt/libvirt-sock
EOF
systemctl restart sshd
permissions: '0755'
owner: root:root
# 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' ]
- [
"sh",
"-c",
'printf "Match user virsh\\n'
" X11Forwarding no\\n"
" AllowTcpForwarding no\\n"
" PermitTTY no\\n"
' ForceCommand nc -q 0 -U /var/run/libvirt/libvirt-sock\\n"'
" >> /etc/ssh/sshd_config",
]
- [ "/root/update_sshd.sh" ]
- [ "rm", "/root/update_sshd.sh" ]
- [ "usermod", "-a", "-G", "libvirt", "virsh" ]
- [ "usermod", "-a", "-G", "libvirt-qemu", "virsh" ]
- [ "systemctl", "restart", "sshd"]
- [ "efibootmgr", "-n", "0001"]
- [ "systemctl", "enable", "ksmtuned"]
- [ "systemctl", "restart", "ksmtuned"]