Fix Ansible installation

This commit is contained in:
Anthony Rose 2021-02-19 23:42:10 +00:00
parent e568d3026b
commit d8c5a4bb89
2 changed files with 27 additions and 1 deletions

View file

@ -18,6 +18,18 @@ pipinstall () {
./bin/pip install --upgrade $1 ./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 if [ ! -x "$HOME/opt/ansible/bin/ansible-playbook" ]; then
python3 -m venv "$HOME/opt/ansible" python3 -m venv "$HOME/opt/ansible"
fi fi
@ -27,3 +39,18 @@ pipinstall pip
pipinstall wheel pipinstall wheel
pipinstall ansible pipinstall ansible
popd 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

View file

@ -9,7 +9,6 @@ PATH="/usr/sbin:/sbin:/usr/bin:/bin"
for dir in $HOME/bin \ for dir in $HOME/bin \
$HOME/.cargo/bin \ $HOME/.cargo/bin \
$HOME/.gem/ruby/2.6.0/bin \ $HOME/.gem/ruby/2.6.0/bin \
$HOME/opt/ansible/bin \
$HOME/opt/centos-git-common \ $HOME/opt/centos-git-common \
/usr/X11R7/bin \ /usr/X11R7/bin \
/usr/X11R6/bin \ /usr/X11R6/bin \