Commit 6bfffa79 authored by Tim Powell's avatar Tim Powell

added check for remote or local hosts fiel is hosts already exists

parent cc4b357a
Pipeline #1009 failed
......@@ -14,7 +14,7 @@ hevpi0
hevpi1
[allpi]
IPADDRESS
localhost ansible_connection=local ansible_python_interpreter="/usr/bin/env python3"
nuliv
hevpi0
hevpi1
......@@ -58,7 +58,11 @@ if [[ -f $hostsfile ]]; then
case $yn in
[Yy]* )
create_hostsfile;;
[Nn]* ) ipaddr=$(sed -n 2p ansible/playbooks/hosts);; # copy IP address in hosts file to variable ipaddr
[Nn]* ) if [[ $(sed -n 2p ansible/playbooks/hosts) == *"localhost"* ]]; then
local=True
else
ipaddr=$(sed -n 2p ansible/playbooks/hosts);; # copy IP address in hosts file to variable ipaddr
fi
* ) echo "Please answer yes or no."; exit 1;;
esac
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment