diff --git a/defaults/main.yml b/defaults/main.yml index f7c8c10..a8b966b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -31,6 +31,9 @@ sahara_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin" sahara_etc_dir: "{{ sahara_bin | dirname }}/etc/sahara" +# venv_download, even when true, will use the fallback method of building the +# venv from scratch if the venv download fails. +sahara_venv_download: "{{ not sahara_developer_mode | bool }}" sahara_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/sahara.tgz sahara_db_config: /etc/sahara/sahara.conf diff --git a/tasks/sahara_install.yml b/tasks/sahara_install.yml index dbe27b5..864d9ec 100644 --- a/tasks/sahara_install.yml +++ b/tasks/sahara_install.yml @@ -43,7 +43,7 @@ dest: "/var/cache/{{ sahara_venv_download_url | basename }}" checksum: "sha1:{{ lookup('url', sahara_venv_download_url | replace('tgz', 'checksum')) }}" register: sahara_get_venv - when: not sahara_developer_mode | bool + when: sahara_venv_download | bool - name: Remove existing venv file: @@ -57,15 +57,14 @@ state: directory mode: "0755" register: sahara_venv_dir + when: sahara_get_venv | changed - name: Unarchive pre-built venv unarchive: src: "/var/cache/{{ sahara_venv_download_url | basename }}" dest: "{{ sahara_bin | dirname }}" copy: "no" - when: - - not sahara_developer_mode | bool - - sahara_get_venv | changed or sahara_venv_dir | changed + when: sahara_get_venv | changed notify: - Restart sahara services @@ -83,7 +82,7 @@ until: install_packages|success retries: 5 delay: 2 - when: sahara_developer_mode | bool + when: sahara_get_venv | failed or sahara_get_venv | skipped notify: - Restart sahara services @@ -93,12 +92,9 @@ state: "absent" when: - ansible_pkg_mgr == 'yum' - - not sahara_developer_mode | bool - - sahara_get_venv | changed or sahara_venv_dir | changed + - sahara_get_venv | changed - name: Update virtualenv path command: > virtualenv-tools --update-path=auto --reinitialize {{ sahara_bin | dirname }} - when: - - not sahara_developer_mode | bool - - sahara_get_venv | changed or sahara_venv_dir | changed + when: sahara_get_venv | changed