From 4797f0805cd72cd00e4725ffda1d1b338d74be50 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 13 Dec 2017 03:56:22 -0500 Subject: [PATCH] Added live output/explanations --- iiab-network | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/iiab-network b/iiab-network index 9948c5dd8..89faa631c 100755 --- a/iiab-network +++ b/iiab-network @@ -12,34 +12,42 @@ if [ ! -f iiab-network.yml ]; then fi if [ ! -f /etc/iiab/config_vars.yml ]; then + echo "Creating stub /etc/iiab/config_vars.yml" 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 + echo "Running /etc/iiab/iiab.env" source /etc/iiab/iiab.env fi +echo "Ansible will now run iiab-network.yml -- monitor log file iiab-network.log" 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 +# Paul Armstrong's Shell Style Guide (https://google.github.io/styleguide/shell.xml) +# prefers "if [[ ... ]]; then" for REGEXP's. Many others prefer "if [ ... ];" then. +# Each approach is sometimes necessary in my experience, working differently indeed. if [ "$OS" == "centos" ] || [ "$OS" == "fedora" ]; then ls -la /etc/sys*/net*/ifcfg* >> iiab-network.log fi -# Ubuntu desktop might be using NM - split out. -# Paul Armstrong's Shell Style Guide: https://google.github.io/styleguide/shell.xml +# Ubuntu desktop/others might be using NM (NetworkManager) - split out. # if [ $(which nmcli) ]; then # syntax fails when multiple lines returned # if [[ `which nmcli` ]]; then # syntax also works if which nmcli; then # syntax works great, with "grep -q" too! nmcli d >> iiab-network.log nmcli c >> iiab-network.log fi + echo "" >> iiab-network.log ip r >> iiab-network.log echo "" >> iiab-network.log @@ -49,7 +57,12 @@ echo "run end: $End" >> iiab-network.log echo "" >> iiab-network.log echo "" >> iiab-network.log + # Put the same diagnostics on screen, for live operator +if which nmcli; then # syntax works great, with "grep -q" too! + nmcli d + nmcli c +fi ip r brctl show echo "run start: $Start"