diff --git a/upgrade.sh b/upgrade.sh index 6747fe9e3d13726b464542f4991880db90798091..822f1586f2c7c9eedbe4654f4237c82c50f16bcf 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -49,6 +49,19 @@ yesno_prompt() { } do_upgrade() { + echo '[Check Ansible installation]' + if [ ! -f "$ansible_bin_path/ansible" ]; then + echo "To make the installation more future proof, we changed how ansible gets installed and now install it in its own venv." + yesno_prompt proceed 'Do you want to migrate to the new ansible installation method?' 'yes' + if [ "$proceed" = "false" ]; then + ansible_bin_path="$HOME/.local/bin" + else + apt-get install -y python3-venv + python3 -m venv $ansible_venv_path + $ansible_venv_path/bin/pip3 install --upgrade pip + $ansible_venv_path/bin/pip3 install ansible=="$ansible_version" + fi + fi echo '[Beginning upgrade]' playbook_path="$ansible_conf_path/playbook.yml" echo "[1/$total_steps] Retrieving currently installed version from $playbook_path"