mirror of
https://github.com/iiab/iiab.git
synced 2025-02-12 11:12:06 +00:00
52 lines
1.4 KiB
Bash
Executable file
52 lines
1.4 KiB
Bash
Executable file
#!/bin/bash
|
|
# running from a git repo
|
|
# ansible files exist
|
|
CWD=`pwd`
|
|
export ANSIBLE_LOG_PATH="$CWD/iiab-network.log"
|
|
|
|
if [ ! -f iiab-network.yml ]; then
|
|
echo "iiab-network.yml not found in current directory."
|
|
echo "Please rerun this command from the top level of the git repo."
|
|
echo "Exiting."
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f /etc/iiab/config_vars.yml ]; then
|
|
mkdir -p /etc/iiab
|
|
echo "{}" > /etc/iiab/config_vars.yml
|
|
fi
|
|
|
|
OS="unknown" # will be overridden below, if /etc/iiab/iiab.env is legit
|
|
if [ -f /etc/iiab/iiab.env ]; then
|
|
source /etc/iiab/iiab.env
|
|
fi
|
|
|
|
Start=`date`
|
|
ansible-playbook -i ansible_hosts iiab-network.yml --connection=local
|
|
End=`date`
|
|
|
|
# Record critical diagnostics to [/opt/iiab/iiab/]iiab-network.log
|
|
echo "" >> iiab-network.log
|
|
# redhat path
|
|
if [ "OS" == "centos" ] || [ "OS" == "fedora" ]; then
|
|
ls -la /etc/sys*/net*/ifcfg* >> iiab-network.log
|
|
fi
|
|
# Ubuntu desktop might be using NM - split out.
|
|
if [[ `which nmcli` ]]; then
|
|
nmcli d >> iiab-network.log
|
|
nmcli c >> iiab-network.log
|
|
fi
|
|
echo "" >> iiab-network.log
|
|
ip r >> iiab-network.log
|
|
echo "" >> iiab-network.log
|
|
brctl show >> iiab-network.log
|
|
echo "run start: $Start" >> iiab-network.log
|
|
echo "run end: $End" >> iiab-network.log
|
|
echo "" >> iiab-network.log
|
|
echo "" >> iiab-network.log
|
|
|
|
# Put the same diagnostics on screen, for live operator
|
|
ip r
|
|
brctl show
|
|
echo "run start: $Start"
|
|
echo "run end: $End"
|