diff --git a/install.sh b/install.sh index 0a895e75f74395113da24017e27fbb62f63f46f8..209d7efb8a8c4f9a3e68438e7157219eaf20b01c 100755 --- a/install.sh +++ b/install.sh @@ -20,7 +20,7 @@ min_python_version_major="3" min_python_version_minor="5" base_path="/srv/funkwhale" ansible_conf_path="$base_path/ansible" -ansible_bin_path="$HOME/.local/bin" +ansible_venv_path="$HOME/.local/ansible" ansible_funkwhale_role_version="${ANSIBLE_FUNKWHALE_ROLE_VERSION-master}" ansible_funkwhale_role_path="${ANSIBLE_FUNKWHALE_ROLE_PATH-}" funkwhale_systemd_after="" @@ -216,9 +216,10 @@ do_install() { init_ansible() { echo "[2/$total_steps] Installing ansible dependencies..." - install_packages curl git python3-pip python3-apt python3-psycopg2 sudo locales locales-all + install_packages curl git python3-pip python3-venv python3-apt python3-psycopg2 sudo locales locales-all echo "[2/$total_steps] Installing Ansible..." - pip3 install --user ansible=="$ansible_version" + python3 -m venv $ansible_venv_path + $ansible_venv_path/bin/pip3 install ansible=="$ansible_version" echo "[2/$total_steps] Creating ansible configuration files in $ansible_conf_path..." mkdir -p "$ansible_conf_path" @@ -287,7 +288,7 @@ EOF #!/bin/sh # reapply playbook with existing parameter # Useful if you changed some variables in playbook.yml -exec $ansible_bin_path/ansible-playbook -i $ansible_conf_path/inventory.ini $ansible_conf_path/playbook.yml -u root $ansible_flags +exec $ansible_venv_path/bin/ansible-playbook -i $ansible_conf_path/inventory.ini $ansible_conf_path/playbook.yml -u root $ansible_flags EOF chmod +x ./reconfigure if [ "$funkwhale_redis_managed" = "false" ]; then @@ -306,7 +307,7 @@ EOF EOF if [ "$ansible_funkwhale_role_path" = '' ]; then echo "[2/$total_steps] Downloading Funkwhale playbook dependencies" - $ansible_bin_path/ansible-galaxy install -r requirements.yml -f + $ansible_venv_path/bin/ansible-galaxy install -r requirements.yml -f else echo "[2/$total_steps] Skipping playbook dependencies, using local role instead" fi @@ -314,7 +315,7 @@ EOF run_playbook() { cd "$ansible_conf_path" echo "[3/$total_steps] Installing Funkwhale using ansible playbook in $ansible_conf_path..." - playbook_command="$ansible_bin_path/ansible-playbook -i $ansible_conf_path/inventory.ini $ansible_conf_path/playbook.yml -u root $ansible_flags" + playbook_command="$ansible_venv_path/bin/ansible-playbook -i $ansible_conf_path/inventory.ini $ansible_conf_path/playbook.yml -u root $ansible_flags" if [ "$is_dry_run" = "true" ]; then playbook_command="$playbook_command --check" echo "[3/$total_steps] Skipping playbook because DRY_RUN=true" diff --git a/upgrade.sh b/upgrade.sh index c833a143d5eacdff33b7f4d8439fc7ae22cb55e9..6747fe9e3d13726b464542f4991880db90798091 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -14,7 +14,8 @@ skip_confirm="${SKIP_CONFIRM-}" is_dry_run=${DRY_RUN-false} base_path="/srv/funkwhale" ansible_conf_path="$base_path/ansible" -ansible_bin_path="$HOME/.local/bin" +ansible_venv_path="$HOME/.local/ansible" +ansible_bin_path="$ansible_venv_path/bin" ansible_funkwhale_role_version="${ANSIBLE_FUNKWHALE_ROLE_VERSION-master}" funkwhale_systemd_after="" total_steps="4"