From fb40a4b82bca3c7e52096231cbb4f0c7ad47ffaf Mon Sep 17 00:00:00 2001 From: Ljuda_Kukharchuk Date: Tue, 1 Nov 2016 20:59:13 +0200 Subject: [PATCH 1/2] refactor code for ansible/windows.sh --- ansible/windows.sh | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/ansible/windows.sh b/ansible/windows.sh index 13d133c6..8906bb9b 100755 --- a/ansible/windows.sh +++ b/ansible/windows.sh @@ -7,19 +7,8 @@ then echo ubuntu:ubuntu | chpasswd fi -if [ "$CHECK_ANSIBLE" == "/usr/bin/ansible" ] +if [ "$CHECK_ANSIBLE" != "/usr/bin/ansible" ] then - # Setup Ansible for Local Use and Run - cp /vagrant/ansible/inventory/vagrant /etc/ansible/hosts -f - chmod 666 /etc/ansible/hosts - if [ "$VERSION_UBUNTU" == "16.04" ] - then - cat /etc/ssh/ssh_host_rsa_key.pub >> /home/ubuntu/.ssh/authorized_keys - else - cat /etc/ssh/ssh_host_rsa_key.pub >> /home/vagrant/.ssh/authorized_keys - fi - sudo ansible-playbook /vagrant/ansible/playbook_vagrant.yml -e hostname=$1 --connection=local #-vvv -else # Update Repositories if [ "$VERSION_UBUNTU" == "14.04" ] then @@ -45,6 +34,8 @@ else sudo apt-get update sudo apt-get install -y ansible --allow-unauthenticated sudo ansible-galaxy install -r /vagrant/ansible/requirements.yml +fi + # Setup Ansible for Local Use and Run cp /vagrant/ansible/inventory/vagrant /etc/ansible/hosts -f chmod 666 /etc/ansible/hosts @@ -54,5 +45,4 @@ else else cat /etc/ssh/ssh_host_rsa_key.pub >> /home/vagrant/.ssh/authorized_keys fi - sudo ansible-playbook /vagrant/ansible/playbook_vagrant.yml -e hostname=$1 --connection=local #-vvv -fi \ No newline at end of file + sudo ansible-playbook /vagrant/ansible/playbook_vagrant.yml -e hostname=$1 --connection=local #-vvv \ No newline at end of file From ce6fa626c1316cbd616bda2a586678f2842b9f33 Mon Sep 17 00:00:00 2001 From: Ljuda_Kukharchuk Date: Tue, 1 Nov 2016 21:06:27 +0200 Subject: [PATCH 2/2] Remove some space --- ansible/windows.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ansible/windows.sh b/ansible/windows.sh index 8906bb9b..5826b08a 100755 --- a/ansible/windows.sh +++ b/ansible/windows.sh @@ -36,13 +36,13 @@ then sudo ansible-galaxy install -r /vagrant/ansible/requirements.yml fi - # Setup Ansible for Local Use and Run - cp /vagrant/ansible/inventory/vagrant /etc/ansible/hosts -f - chmod 666 /etc/ansible/hosts - if [ "$VERSION_UBUNTU" == "16.04" ] - then - cat /etc/ssh/ssh_host_rsa_key.pub >> /home/ubuntu/.ssh/authorized_keys - else - cat /etc/ssh/ssh_host_rsa_key.pub >> /home/vagrant/.ssh/authorized_keys - fi - sudo ansible-playbook /vagrant/ansible/playbook_vagrant.yml -e hostname=$1 --connection=local #-vvv \ No newline at end of file +# Setup Ansible for Local Use and Run +cp /vagrant/ansible/inventory/vagrant /etc/ansible/hosts -f +chmod 666 /etc/ansible/hosts +if [ "$VERSION_UBUNTU" == "16.04" ] + then + cat /etc/ssh/ssh_host_rsa_key.pub >> /home/ubuntu/.ssh/authorized_keys +else + cat /etc/ssh/ssh_host_rsa_key.pub >> /home/vagrant/.ssh/authorized_keys +fi +sudo ansible-playbook /vagrant/ansible/playbook_vagrant.yml -e hostname=$1 --connection=local #-vvv \ No newline at end of file