Only install to virtual environment
Remove all tasks and variables related to toggling between installation of sahara inside or outside of a Python virtual environment. Installing within a venv is now the only supported deployment. Additionally, a few changes have been made to make the creation of the venv more resistant to interruptions during a run of the role. * unarchiving a pre-built venv will now also occur when the venv directory is created, not only after being downloaded * virtualenv-tools is run against both pre-built and non pre-built venvs to account for interruptions during or prior to unarchiving Change-Id: I1ca77e5125911a6d6ac0745abd2259ee3ece4612 Implements: blueprint only-install-venvs
This commit is contained in:
parent
9d27388916
commit
625304c636
@ -23,24 +23,10 @@ sahara_developer_constraints:
|
|||||||
- "git+{{ sahara_git_repo }}@{{ sahara_git_install_branch }}#egg=sahara"
|
- "git+{{ sahara_git_repo }}@{{ sahara_git_install_branch }}#egg=sahara"
|
||||||
|
|
||||||
# Name of the virtual env to deploy into
|
# Name of the virtual env to deploy into
|
||||||
sahara_venv_tag: untagged
|
sahara_venv_tag: untagged
|
||||||
sahara_venv_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin"
|
sahara_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin"
|
||||||
|
|
||||||
# Set this to enable or disable installing in a venv
|
sahara_etc_dir: "{{ sahara_bin | dirname }}/etc/sahara"
|
||||||
sahara_venv_enabled: true
|
|
||||||
|
|
||||||
# The bin path defaults to the venv path however if installation in a
|
|
||||||
# venv is disabled the bin path will be dynamically set based on the
|
|
||||||
# system path used when the installing.
|
|
||||||
sahara_bin: "{{ sahara_venv_bin }}"
|
|
||||||
|
|
||||||
# Set the etc dir path where sahara is installed.
|
|
||||||
# This is used for role access to the db migrations.
|
|
||||||
# Example:
|
|
||||||
# sahara_etc_dir: "/usr/local/etc/sahara"
|
|
||||||
sahara_venv_etc_dir: "{{ sahara_bin | dirname }}/etc/sahara"
|
|
||||||
sahara_non_venv_etc_dir: "/usr/local/etc/sahara"
|
|
||||||
sahara_etc_dir: "{{ (sahara_venv_enabled | bool) | ternary(sahara_venv_etc_dir, sahara_non_venv_etc_dir) }}"
|
|
||||||
|
|
||||||
sahara_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/sahara.tgz
|
sahara_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/sahara.tgz
|
||||||
|
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- Installation of sahara and its dependent pip packages will now only
|
||||||
|
occur within a Python virtual environment. The ``sahara_venv_bin``,
|
||||||
|
``sahara_venv_enabled``, ``sahara_venv_etc_dir``, and
|
||||||
|
``sahara_non_venv_etc_dir`` variables have been removed.
|
@ -82,7 +82,6 @@
|
|||||||
get_md5: False
|
get_md5: False
|
||||||
when:
|
when:
|
||||||
- not sahara_developer_mode | bool
|
- not sahara_developer_mode | bool
|
||||||
- sahara_venv_enabled | bool
|
|
||||||
register: local_venv_stat
|
register: local_venv_stat
|
||||||
tags:
|
tags:
|
||||||
- sahara-install
|
- sahara-install
|
||||||
@ -94,7 +93,6 @@
|
|||||||
return_content: True
|
return_content: True
|
||||||
when:
|
when:
|
||||||
- not sahara_developer_mode | bool
|
- not sahara_developer_mode | bool
|
||||||
- sahara_venv_enabled | bool
|
|
||||||
register: remote_venv_checksum
|
register: remote_venv_checksum
|
||||||
tags:
|
tags:
|
||||||
- sahara-install
|
- sahara-install
|
||||||
@ -114,7 +112,6 @@
|
|||||||
register: get_venv
|
register: get_venv
|
||||||
when:
|
when:
|
||||||
- not sahara_developer_mode | bool
|
- not sahara_developer_mode | bool
|
||||||
- sahara_venv_enabled | bool
|
|
||||||
- (local_venv_stat.stat.exists == False or
|
- (local_venv_stat.stat.exists == False or
|
||||||
{{ local_venv_stat.stat.checksum is defined and local_venv_stat.stat.checksum != remote_venv_checksum.content | trim }})
|
{{ local_venv_stat.stat.checksum is defined and local_venv_stat.stat.checksum != remote_venv_checksum.content | trim }})
|
||||||
tags:
|
tags:
|
||||||
@ -124,17 +121,15 @@
|
|||||||
- name: Set sahara get_venv fact
|
- name: Set sahara get_venv fact
|
||||||
set_fact:
|
set_fact:
|
||||||
sahara_get_venv: "{{ get_venv }}"
|
sahara_get_venv: "{{ get_venv }}"
|
||||||
when: sahara_venv_enabled | bool
|
|
||||||
tags:
|
tags:
|
||||||
- sahara-install
|
- sahara-install
|
||||||
- sahara-pip-packages
|
- sahara-pip-packages
|
||||||
|
|
||||||
- name: Remove existing venv
|
- name: Remove existing venv
|
||||||
file:
|
file:
|
||||||
path: "{{ sahara_venv_bin | dirname }}"
|
path: "{{ sahara_bin | dirname }}"
|
||||||
state: absent
|
state: absent
|
||||||
when:
|
when:
|
||||||
- sahara_venv_enabled | bool
|
|
||||||
- sahara_get_venv | changed
|
- sahara_get_venv | changed
|
||||||
tags:
|
tags:
|
||||||
- sahara-install
|
- sahara-install
|
||||||
@ -142,12 +137,9 @@
|
|||||||
|
|
||||||
- name: Create sahara venv dir
|
- name: Create sahara venv dir
|
||||||
file:
|
file:
|
||||||
path: "{{ sahara_venv_bin | dirname }}"
|
path: "{{ sahara_bin | dirname }}"
|
||||||
state: directory
|
state: directory
|
||||||
when:
|
register: sahara_venv_dir
|
||||||
- not sahara_developer_mode | bool
|
|
||||||
- sahara_venv_enabled | bool
|
|
||||||
- sahara_get_venv | changed
|
|
||||||
tags:
|
tags:
|
||||||
- sahara-install
|
- sahara-install
|
||||||
- sahara-pip-packages
|
- sahara-pip-packages
|
||||||
@ -155,34 +147,22 @@
|
|||||||
- name: Unarchive pre-built venv
|
- name: Unarchive pre-built venv
|
||||||
unarchive:
|
unarchive:
|
||||||
src: "/var/cache/{{ sahara_venv_download_url | basename }}"
|
src: "/var/cache/{{ sahara_venv_download_url | basename }}"
|
||||||
dest: "{{ sahara_venv_bin | dirname }}"
|
dest: "{{ sahara_bin | dirname }}"
|
||||||
copy: "no"
|
copy: "no"
|
||||||
when:
|
when:
|
||||||
- not sahara_developer_mode | bool
|
- not sahara_developer_mode | bool
|
||||||
- sahara_venv_enabled | bool
|
- sahara_get_venv | changed or sahara_venv_dir | changed
|
||||||
- sahara_get_venv | changed
|
|
||||||
notify:
|
notify:
|
||||||
- Restart sahara services
|
- Restart sahara services
|
||||||
tags:
|
tags:
|
||||||
- sahara-install
|
- sahara-install
|
||||||
- sahara-pip-packages
|
- sahara-pip-packages
|
||||||
|
|
||||||
- name: Update virtualenv path
|
|
||||||
command: >
|
|
||||||
virtualenv-tools --update-path=auto {{ sahara_venv_bin | dirname }}
|
|
||||||
when:
|
|
||||||
- not sahara_developer_mode | bool
|
|
||||||
- sahara_venv_enabled | bool
|
|
||||||
- sahara_get_venv | success
|
|
||||||
tags:
|
|
||||||
- sahara-install
|
|
||||||
- sahara-pip-packages
|
|
||||||
|
|
||||||
- name: Install pip packages (venv)
|
- name: Install pip packages (venv)
|
||||||
pip:
|
pip:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
virtualenv: "{{ sahara_venv_bin | dirname }}"
|
virtualenv: "{{ sahara_bin | dirname }}"
|
||||||
virtualenv_site_packages: "no"
|
virtualenv_site_packages: "no"
|
||||||
extra_args: "{{ pip_install_options_fact }}"
|
extra_args: "{{ pip_install_options_fact }}"
|
||||||
register: install_packages
|
register: install_packages
|
||||||
@ -191,7 +171,6 @@
|
|||||||
delay: 2
|
delay: 2
|
||||||
with_items: "{{ sahara_pip_packages }}"
|
with_items: "{{ sahara_pip_packages }}"
|
||||||
when:
|
when:
|
||||||
- sahara_venv_enabled | bool
|
|
||||||
- sahara_get_venv | failed or sahara_developer_mode | bool
|
- sahara_get_venv | failed or sahara_developer_mode | bool
|
||||||
notify:
|
notify:
|
||||||
- Restart sahara services
|
- Restart sahara services
|
||||||
@ -199,21 +178,13 @@
|
|||||||
- sahara-install
|
- sahara-install
|
||||||
- sahara-pip-packages
|
- sahara-pip-packages
|
||||||
|
|
||||||
- name: Install pip packages (no venv)
|
- name: Update virtualenv path
|
||||||
pip:
|
command: >
|
||||||
name: "{{ item }}"
|
virtualenv-tools --update-path=auto {{ sahara_bin | dirname }}
|
||||||
state: present
|
|
||||||
extra_args: "{{ pip_install_options_fact }}"
|
|
||||||
register: install_packages
|
|
||||||
until: install_packages|success
|
|
||||||
retries: 5
|
|
||||||
delay: 2
|
|
||||||
with_items: "{{ sahara_pip_packages }}"
|
|
||||||
when:
|
when:
|
||||||
- not sahara_venv_enabled | bool
|
|
||||||
- not sahara_developer_mode | bool
|
- not sahara_developer_mode | bool
|
||||||
notify:
|
- sahara_get_venv | success
|
||||||
- Restart sahara services
|
|
||||||
tags:
|
tags:
|
||||||
- sahara-install
|
- sahara-install
|
||||||
- sahara-pip-packages
|
- sahara-pip-packages
|
||||||
|
|
||||||
|
@ -39,18 +39,3 @@
|
|||||||
tags:
|
tags:
|
||||||
- sahara-config
|
- sahara-config
|
||||||
|
|
||||||
- name: Get sahara command path
|
|
||||||
command: which sahara
|
|
||||||
register: sahara_command_path
|
|
||||||
when:
|
|
||||||
- not sahara_venv_enabled | bool
|
|
||||||
tags:
|
|
||||||
- sahara-command-bin
|
|
||||||
|
|
||||||
- name: Set sahara command path
|
|
||||||
set_fact:
|
|
||||||
sahara_bin: "{{ sahara_command_path.stdout | dirname }}"
|
|
||||||
when:
|
|
||||||
- not sahara_venv_enabled | bool
|
|
||||||
tags:
|
|
||||||
- sahara-command-bin
|
|
||||||
|
@ -46,17 +46,6 @@
|
|||||||
tags:
|
tags:
|
||||||
- sahara-dirs
|
- sahara-dirs
|
||||||
|
|
||||||
- name: Create sahara venv dir
|
|
||||||
file:
|
|
||||||
path: "{{ item.path }}"
|
|
||||||
state: directory
|
|
||||||
with_items:
|
|
||||||
- { path: "/openstack/venvs" }
|
|
||||||
- { path: "{{ sahara_venv_bin }}" }
|
|
||||||
when: sahara_venv_enabled | bool
|
|
||||||
tags:
|
|
||||||
- sahara-dirs
|
|
||||||
|
|
||||||
- name: Test for log directory or link
|
- name: Test for log directory or link
|
||||||
shell: |
|
shell: |
|
||||||
if [ -h "/var/log/sahara" ]; then
|
if [ -h "/var/log/sahara" ]; then
|
||||||
|
@ -23,9 +23,7 @@ pre-start script
|
|||||||
mkdir -p "/var/lock/{{ program_name }}"
|
mkdir -p "/var/lock/{{ program_name }}"
|
||||||
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_name }}"
|
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_name }}"
|
||||||
|
|
||||||
{% if sahara_venv_enabled | bool -%}
|
. {{ sahara_bin }}/activate
|
||||||
. {{ sahara_venv_bin }}/activate
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
end script
|
end script
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ sahara_container_mysql_password: "SuperSecrete"
|
|||||||
sahara_rabbitmq_password: "secrete"
|
sahara_rabbitmq_password: "secrete"
|
||||||
sahara_rabbitmq_userid: sahara
|
sahara_rabbitmq_userid: sahara
|
||||||
sahara_rabbitmq_vhost: /sahara
|
sahara_rabbitmq_vhost: /sahara
|
||||||
sahara_venv_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin"
|
sahara_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin"
|
||||||
tempest_developer_mode: True
|
tempest_developer_mode: True
|
||||||
tempest_git_install_branch: master
|
tempest_git_install_branch: master
|
||||||
tempest_venv_tag: "{{ tempest_git_install_branch }}"
|
tempest_venv_tag: "{{ tempest_git_install_branch }}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user