forked from karmab/kcli-ztp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path00_virtual.sh.redfish
executable file
·24 lines (22 loc) · 1.05 KB
/
00_virtual.sh.redfish
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
set -euo pipefail
{% if not 'rhel' in image %}
dnf clean all
sleep 30
{% endif %}
echo "fastestmirror=1" >> /etc/dnf/dnf.conf
dnf -y install pkgconf-pkg-config libvirt-devel gcc python3-libvirt python3 git python3-netifaces
pip3 install sushy-tools
systemctl enable --now sushy
sleep 20
ssh-keyscan -H {{ config_host if config_host != '127.0.0.1' else baremetal_net|local_ip }} >> /root/.ssh/known_hosts
echo -e "Host=*\nStrictHostKeyChecking=no\n" > /root/.ssh/config
python3 /root/bin/sushy.py {{ installer_nic }}
api_vip=$(grep apiVIP /root/install-config.yaml | awk -F: '{print $2}' | xargs)
cluster=$(grep -m 1 name /root/install-config.yaml | awk -F: '{print $2}' | xargs)
domain=$(grep baseDomain /root/install-config.yaml | awk -F: '{print $2}' | xargs)
IP=$(ip -o addr show {{ installer_nic }}|head -1 | awk '{print $4}' | cut -d "/" -f 1 | head -1)
echo $IP | grep -q ':' && IP=[$IP]
sed -i "s/DONTCHANGEME/$IP/" /root/install-config.yaml
sed -i "s/DONTCHANGEME/$IP/" /root/extra_worker.yml
echo $api_vip api.$cluster.$domain >> /etc/hosts