diff --git a/defaults/main.yml b/defaults/main.yml index 32e4e20b..a2eb8581 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -29,6 +29,8 @@ horizon_venv_enabled: true # system path used when the installing. horizon_bin: "{{ horizon_venv_bin }}" +horizon_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/horizon.tgz + ## System info horizon_system_user_name: horizon horizon_system_group_name: www-data @@ -137,6 +139,7 @@ horizon_apt_packages: # horizon packages that must be installed before anything else horizon_requires_pip_packages: - virtualenv + - virtualenv-tools - python-keystoneclient # Keystoneclient needed to OSA keystone lib horizon_pip_packages: diff --git a/tasks/horizon_install.yml b/tasks/horizon_install.yml index beb6a70b..16e8ad40 100644 --- a/tasks/horizon_install.yml +++ b/tasks/horizon_install.yml @@ -50,7 +50,9 @@ delay: 2 with_items: - "{{ horizon_pip_packages }}" - when: horizon_venv_enabled | bool + when: + - horizon_venv_enabled | bool + - horizon_get_venv | failed tags: - horizon-pip-packages diff --git a/tasks/horizon_pre_install.yml b/tasks/horizon_pre_install.yml index fe0ca767..96f925f2 100644 --- a/tasks/horizon_pre_install.yml +++ b/tasks/horizon_pre_install.yml @@ -71,6 +71,58 @@ tags: - horizon-pip-packages +- name: Attempt venv download + get_url: + url: "{{ horizon_venv_download_url }}" + dest: "/var/cache/{{ horizon_venv_download_url | basename }}" + ignore_errors: true + register: get_venv + when: horizon_venv_enabled | bool + tags: + - horizon-install + - horizon-pip-packages + +- name: Set horizon get_venv fact + set_fact: + horizon_get_venv: "{{ get_venv }}" + when: horizon_venv_enabled | bool + tags: + - horizon-install + - horizon-pip-packages + +- name: Create horizon venv dir + file: + path: "{{ horizon_venv_bin | dirname }}" + state: directory + when: + - horizon_venv_enabled | bool + - horizon_get_venv | success + tags: + - horizon-install + - horizon-pip-packages + +- name: Unarchive pre-built venv + unarchive: + src: "/var/cache/{{ horizon_venv_download_url | basename }}" + dest: "{{ horizon_venv_bin | dirname }}" + copy: "no" + when: + - horizon_venv_enabled | bool + - horizon_get_venv | success + tags: + - horizon-install + - horizon-pip-packages + +- name: Update virtualenv path + command: > + virtualenv-tools --update-path=auto {{ horizon_venv_bin | dirname }} + when: + - horizon_venv_enabled | bool + - horizon_get_venv | success + tags: + - horizon-install + - horizon-pip-packages + - name: Create horizon venv pip: name: "{{ item }}" @@ -80,8 +132,11 @@ extra_args: "{{ pip_install_options|default('') }}" with_items: - "{{ horizon_requires_pip_packages }}" - when: horizon_venv_enabled | bool + when: + - horizon_venv_enabled | bool + - horizon_get_venv | failed tags: + - horizon-install - horizon-pip-packages - name: Create horizon links for venv @@ -96,6 +151,7 @@ dest: "{{ horizon_lib_dir }}" when: horizon_venv_enabled | bool tags: + - horizon-install - horizon-configs - name: Create static horizon dir