infctl-cli/vagrant/dev/ubuntu/scripts/longhorn_prereqs.sh

33 lines
1.1 KiB
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
echo
echo "vagrant longhorn prerequisites"
echo
ssh-add ~/.ssh/vm*_key
source /home/vagrant/ansible/venv/bin/activate
ANSIBLE_SUPPRESS_INTERPRETER_DISCOVERY_WARNING=1 ANSIBLE_HOST_KEY_CHECKING=False ansible --inventory-file /home/vagrant/ansible/ansible_inventory.ini -m ping vm1,vm2,vm3
if [ $? -ne 0 ]; then
echo "Ansible ping failed. Please check your Vagrant VMs and network configuration."
exit 1
fi
echo "Ansible ping successful."
# Check if there are any pods in the longhorn-system namespace
if kubectl -n longhorn-system get pods --no-headers 2>/dev/null | grep -q '^[^ ]'; then
echo "Pods already exist in the longhorn-system namespace. Skipping installation."
exit 0
fi
exit
echo "Installing Longhorn prerequisites..."
# install_longhorn_prereqs.yaml
ANSIBLE_SUPPRESS_INTERPRETER_DISCOVERY_WARNING=1 ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook ~/ansible/install_longhorn_prereqs.yaml --inventory-file /home/vagrant/ansible/ansible_inventory.ini
if [ $? -ne 0 ]; then
echo "Ansible playbook failed. Please check the playbook and your inventory."
exit 1
fi