From 74ab7b3f7233c1f13d5794b3fc14684c20bc4551 Mon Sep 17 00:00:00 2001 From: as22323 Date: Sun, 3 Jun 2018 17:49:25 -0400 Subject: [PATCH 1/2] New function to check os and update *.cfg control_path accordingly --- metron-deployment/amazon-ec2/run.sh | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/metron-deployment/amazon-ec2/run.sh b/metron-deployment/amazon-ec2/run.sh index 96c07af1d1..c072e89b8a 100755 --- a/metron-deployment/amazon-ec2/run.sh +++ b/metron-deployment/amazon-ec2/run.sh @@ -16,6 +16,38 @@ # limitations under the License. # +# +# Check operating system and change the control_path in ansible.cfg +# accordingly +# +changeAnsibleControlPath() +{ + unameosname=`uname` + filename="ansible.cfg" + + case $unameosname in + 'Linux'*) + #platform='Linux' + ansiblecontrolpath="~/.ssh/ansbile-ssh-%%h-%%r" + ;; + 'Darwin'*) + #platform='Mac OS/Darwin' + ansiblecontrolpath="~/.ssh/ansbile-ssh-%%C" + ;; + *) + #platform='Other' + ansiblecontrolpath="" + ;; + esac + + if [ ! -z ansiblecontrolpath ] + then + #Make the change to the control_path. Ignore #comments + sed -i.bak -e "/^#/!s|control_path.*=.*|control_path =$ansiblecontrolpath|g" -- "${filename}" + fi +} +changeAnsibleControlPath + # # Builds Metron platform jars, instantiates hosts, and deploys Metron to those # hosts on Amazon EC2 From a2a1388e61e21df8b93c1e280bac6ed686940f41 Mon Sep 17 00:00:00 2001 From: as22323 Date: Sun, 3 Jun 2018 19:17:14 -0400 Subject: [PATCH 2/2] inc comment on function that overwrites control_path --- metron-deployment/amazon-ec2/ansible.cfg | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/metron-deployment/amazon-ec2/ansible.cfg b/metron-deployment/amazon-ec2/ansible.cfg index 0fe3343ace..71523a78c2 100644 --- a/metron-deployment/amazon-ec2/ansible.cfg +++ b/metron-deployment/amazon-ec2/ansible.cfg @@ -14,6 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# +# The function changeAnsibleControlPath() in run.sh might overwrite +# the control_path according to your operating system. +# To stop overwriting comment out changeAnsibleControlPath in run.sh +# + [defaults] host_key_checking = False library = ../ansible/extra_modules