From d8c5a4bb8915e58106bfbecdb39e3d953e00e4b2 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Fri, 19 Feb 2021 23:42:10 +0000 Subject: [PATCH] Fix Ansible installation --- ansible-setup.sh | 27 +++++++++++++++++++++++++++ roles/home-cli/files/shrc | 1 - 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ansible-setup.sh b/ansible-setup.sh index 40e8a8d..59cc96b 100755 --- a/ansible-setup.sh +++ b/ansible-setup.sh @@ -18,6 +18,18 @@ pipinstall () { ./bin/pip install --upgrade $1 } +create_link () { + ln -sf "../opt/ansible/bin/$1" "$HOME/bin/$1" +} + +py3cmd="$(command -v python3)" +if [ ! -x "$py3cmd" ]; then + echo "python3 not found" + return 1 +else + echo "python3 found: $py3cmd" +fi + if [ ! -x "$HOME/opt/ansible/bin/ansible-playbook" ]; then python3 -m venv "$HOME/opt/ansible" fi @@ -27,3 +39,18 @@ pipinstall pip pipinstall wheel pipinstall ansible popd + +for command in \ + ansible \ + ansible-config \ + ansible-connection \ + ansible-console \ + ansible-doc \ + ansible-galaxy \ + ansible-inventory \ + ansible-playbook \ + ansible-pull \ + ansible-test \ + ansible-vault; do + create_link $command +done diff --git a/roles/home-cli/files/shrc b/roles/home-cli/files/shrc index 2b3de63..ec85f78 100644 --- a/roles/home-cli/files/shrc +++ b/roles/home-cli/files/shrc @@ -9,7 +9,6 @@ PATH="/usr/sbin:/sbin:/usr/bin:/bin" for dir in $HOME/bin \ $HOME/.cargo/bin \ $HOME/.gem/ruby/2.6.0/bin \ - $HOME/opt/ansible/bin \ $HOME/opt/centos-git-common \ /usr/X11R7/bin \ /usr/X11R6/bin \