
This change allows the MNAIO to really be used as a stand alone kick system which has the potential to be developed into a stand alone project. At the very least this change improves playbook performance by scoping variables. The inventory has been converted into a typical Ansible inventory and the "servers" used in the MNAIO are now simply host_vars which will trigger specific VM builds when instructed to do so. This gives the MNAIO the ability to serve as a stand alone kick system which could be used for physical hosts as well as MNAIO testing all through the same basic set of playbooks. Should a deployer want to use this with physical servers they'd need to do nothing more than define their basic inventory and where the the required pieces of infrastructure needed to PXE boot their machines. Change-Id: I6c47e02ecfbe8ee7533e77b11041785db485a1a9 Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
36 lines
1.2 KiB
Django/Jinja
36 lines
1.2 KiB
Django/Jinja
#!/usr/bin/env bash
|
|
|
|
apt-get remove --purge snap* lxc* lxd* || true
|
|
|
|
sed -i 's/\(GRUB_CMDLINE_LINUX_DEFAULT=\).*/\1\"\"/g' /target/etc/default/grub
|
|
update-grub
|
|
|
|
sed -i '/PermitRootLogin / s/ .*/ yes/' /etc/ssh/sshd_config
|
|
|
|
mkdir -p /root/.ssh
|
|
chmod 0700 /root/.ssh
|
|
echo "{{ tftp_ssh_key }}" >> /root/.ssh/authorized_keys
|
|
|
|
wget --no-proxy http://{{ tftp_server }}/networking/$(cat /etc/hostname)-bridges.cfg -O /etc/network/interfaces.d/vm-bridges.cfg
|
|
wget --no-proxy http://{{ tftp_server }}/networking/basic-debian-interface.cfg -O /etc/network/interfaces
|
|
|
|
cat > /etc/network/if-up.d/post-up-rules <<EOF
|
|
#!/usr/bin/env bash
|
|
|
|
function iptables_filter_rule_add {
|
|
if ! iptables -w -t $1 -C $2;then
|
|
/sbin/iptables -w -t $1 -I $2
|
|
fi
|
|
}
|
|
|
|
# To ensure ssh checksum is correct
|
|
iptables_filter_rule_add "mangle" "POSTROUTING -p tcp --dport 22 -j CHECKSUM --checksum-fill"
|
|
|
|
# To provide internet connectivity to instances
|
|
iptables_filter_rule_add "nat" "POSTROUTING -o \$(ip route get 1 | awk '{print $5}') -j MASQUERADE"
|
|
|
|
# Make sure instances can talk to the metadata server
|
|
iptables_filter_rule_add "mangle" "POSTROUTING -p tcp --sport 80 -j CHECKSUM --checksum-fill"
|
|
EOF
|
|
chmod + /etc/network/if-up.d/post-up-rules
|