Skip to content

Commit

Permalink
correctly uninstall previous versions of ansible (#333)
Browse files Browse the repository at this point in the history
* Update run-ansible.sh

* Update run-ansible.sh

* Update run-ansible.sh
  • Loading branch information
ToivoS authored Jan 20, 2021
1 parent a0802cd commit a7f30bd
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions bin/run-ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,16 @@ echo ""

pushd $aurora_home

ansible_version=$(pip3 freeze | grep ansible== | tr -d "ansible==")
if [[ "${ansible_version}" != "" && "${ansible_version}" != *"2.10"* ]]; then
echo "Uninstalling pre-existing Ansible version which is not supported by aurora, if prompted for sudo password, please enter it"
ansible_version_pip3=$(pip3 freeze | grep ansible== | tr -d "ansible==")
if [[ "${ansible_version_pip3}" != "" && "${ansible_version_pip3}" != *"2.10"* ]]; then
echo "Uninstalling pre-existing pip3 Ansible version $ansible_version_pip3 which is not supported by aurora, if prompted for sudo password, please enter it"
sudo pip3 uninstall -y ansible
fi
ansible_version_pip2=$(pip2 freeze | grep ansible== | tr -d "ansible==")
if [[ "${ansible_version_pip2}" != "" && "${ansible_version_pip2}" != *"2.10"* ]]; then
echo "Uninstalling pre-existing pip2 Ansible version $ansible_version_pip2 which is not supported by aurora, if prompted for sudo password, please enter it"
sudo pip2 uninstall -y ansible
fi
pip3 install --user -r ansible/data/ansible/requirements.txt
ansible_flags="-v "

Expand Down Expand Up @@ -300,9 +305,18 @@ ansible_executable=~/.local/bin/ansible-playbook
if [[ ! -f "${ansible_executable}" ]]; then
ansible_executable=ansible-playbook
fi
ansible_basic_executable=~/.local/bin/ansible
if [[ ! -f "${ansible_basic_executable}" ]]; then
ansible_basic_executable=ansible
fi
ansible_galaxy_executable=~/.local/bin/ansible-galaxy
if [[ ! -f "${ansible_galaxy_executable}" ]]; then
ansible_galaxy_executable=ansible-galaxy
fi

# install ansible galaxy docker and aws collections
ansible-galaxy collection install community.docker amazon.aws
"${ansible_basic_executable}" --version
"${ansible_galaxy_executable}" collection install community.docker amazon.aws

#configure DHCP before running the actual playbook
if [[ "${playbook}" = "server_and_nuc_deploy" ]]; then
Expand Down

0 comments on commit a7f30bd

Please sign in to comment.