Only install to virtual environment
Remove all tasks and variables related to toggling between installation of aodh 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: Icf788b07738bf03708c05929bb82c7b51605ccca Implements: blueprint only-install-venvs
This commit is contained in:
parent
9fb5cf4529
commit
30da818256
|
@ -26,15 +26,7 @@ aodh_developer_constraints:
|
|||
|
||||
# Name of the virtual env to deploy into
|
||||
aodh_venv_tag: untagged
|
||||
aodh_venv_bin: "/openstack/venvs/aodh-{{ aodh_venv_tag }}/bin"
|
||||
|
||||
# Set this to enable or disable installing in a venv
|
||||
aodh_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.
|
||||
aodh_bin: "{{ aodh_venv_bin }}"
|
||||
aodh_bin: "/openstack/venvs/aodh-{{ aodh_venv_tag }}/bin"
|
||||
|
||||
aodh_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/aodh.tgz
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
upgrade:
|
||||
- Installation of aodh and its dependent pip packages will now only
|
||||
occur within a Python virtual environment. The ``aodh_venv_enabled``
|
||||
and ``aodh_venv_bin`` variables have been removed.
|
|
@ -83,7 +83,6 @@
|
|||
get_md5: False
|
||||
when:
|
||||
- not aodh_developer_mode | bool
|
||||
- aodh_venv_enabled | bool
|
||||
register: local_venv_stat
|
||||
tags:
|
||||
- aodh-install
|
||||
|
@ -95,7 +94,6 @@
|
|||
return_content: True
|
||||
when:
|
||||
- not aodh_developer_mode | bool
|
||||
- aodh_venv_enabled | bool
|
||||
register: remote_venv_checksum
|
||||
tags:
|
||||
- aodh-install
|
||||
|
@ -115,7 +113,6 @@
|
|||
register: get_venv
|
||||
when:
|
||||
- not aodh_developer_mode | bool
|
||||
- aodh_venv_enabled | bool
|
||||
- (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 }})
|
||||
tags:
|
||||
|
@ -125,17 +122,15 @@
|
|||
- name: Set aodh get_venv fact
|
||||
set_fact:
|
||||
aodh_get_venv: "{{ get_venv }}"
|
||||
when: aodh_venv_enabled | bool
|
||||
tags:
|
||||
- aodh-install
|
||||
- aodh-pip-packages
|
||||
|
||||
- name: Remove existing venv
|
||||
file:
|
||||
path: "{{ aodh_venv_bin | dirname }}"
|
||||
path: "{{ aodh_bin | dirname }}"
|
||||
state: absent
|
||||
when:
|
||||
- aodh_venv_enabled | bool
|
||||
- aodh_get_venv | changed
|
||||
tags:
|
||||
- aodh-install
|
||||
|
@ -143,11 +138,11 @@
|
|||
|
||||
- name: Create aodh venv dir
|
||||
file:
|
||||
path: "{{ aodh_venv_bin | dirname }}"
|
||||
path: "{{ aodh_bin | dirname }}"
|
||||
state: directory
|
||||
register: aodh_venv_dir
|
||||
when:
|
||||
- not aodh_developer_mode | bool
|
||||
- aodh_venv_enabled | bool
|
||||
- aodh_get_venv | changed
|
||||
tags:
|
||||
- aodh-install
|
||||
|
@ -156,33 +151,21 @@
|
|||
- name: Unarchive pre-built venv
|
||||
unarchive:
|
||||
src: "/var/cache/{{ aodh_venv_download_url | basename }}"
|
||||
dest: "{{ aodh_venv_bin | dirname }}"
|
||||
dest: "{{ aodh_bin | dirname }}"
|
||||
copy: "no"
|
||||
when:
|
||||
- not aodh_developer_mode | bool
|
||||
- aodh_venv_enabled | bool
|
||||
- aodh_get_venv | changed
|
||||
- aodh_get_venv | changed or aodh_venv_dir | changed
|
||||
notify: Restart aodh services
|
||||
tags:
|
||||
- aodh-install
|
||||
- aodh-pip-packages
|
||||
|
||||
- name: Update virtualenv path
|
||||
command: >
|
||||
virtualenv-tools --update-path=auto {{ aodh_venv_bin | dirname }}
|
||||
when:
|
||||
- not aodh_developer_mode | bool
|
||||
- aodh_venv_enabled | bool
|
||||
- aodh_get_venv | success
|
||||
tags:
|
||||
- aodh-install
|
||||
- aodh-pip-packages
|
||||
|
||||
- name: Install pip packages (venv)
|
||||
- name: Install pip packages
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
virtualenv: "{{ aodh_venv_bin | dirname }}"
|
||||
virtualenv: "{{ aodh_bin | dirname }}"
|
||||
virtualenv_site_packages: "no"
|
||||
extra_args: "{{ pip_install_options_fact }}"
|
||||
register: install_packages
|
||||
|
@ -191,28 +174,17 @@
|
|||
delay: 2
|
||||
with_items: "{{ aodh_pip_packages }}"
|
||||
when:
|
||||
- aodh_venv_enabled | bool
|
||||
- aodh_get_venv | failed or aodh_developer_mode | bool
|
||||
notify: Restart aodh services
|
||||
tags:
|
||||
- aodh-install
|
||||
- aodh-pip-packages
|
||||
|
||||
- name: Install pip packages (no venv)
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
extra_args: "{{ pip_install_options_fact }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: "{{ aodh_pip_packages }}"
|
||||
- name: Update virtualenv path
|
||||
command: >
|
||||
virtualenv-tools --update-path=auto {{ aodh_bin | dirname }}
|
||||
when:
|
||||
- not aodh_developer_mode | bool
|
||||
- not aodh_venv_enabled | bool
|
||||
|
||||
notify: Restart aodh services
|
||||
tags:
|
||||
- aodh-install
|
||||
- aodh-pip-packages
|
||||
- aodh-pip-packages
|
|
@ -13,22 +13,6 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Get aodh command path
|
||||
command: which aodh-api
|
||||
register: aodh_command_path
|
||||
when:
|
||||
- not aodh_venv_enabled | bool
|
||||
tags:
|
||||
- aodh-command-bin
|
||||
|
||||
- name: Set aodh command path
|
||||
set_fact:
|
||||
aodh_bin: "{{ aodh_command_path.stdout | dirname }}"
|
||||
when:
|
||||
- not aodh_venv_enabled | bool
|
||||
tags:
|
||||
- aodh-command-bin
|
||||
|
||||
- name: Copy aodh config
|
||||
config_template:
|
||||
src: "{{ item.src }}"
|
||||
|
|
|
@ -48,17 +48,6 @@
|
|||
tags:
|
||||
- aodh-dirs
|
||||
|
||||
- name: Create aodh venv dir
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- { path: "/openstack/venvs" }
|
||||
- { path: "{{ aodh_venv_bin }}" }
|
||||
when: aodh_venv_enabled | bool
|
||||
tags:
|
||||
- aodh-dirs
|
||||
|
||||
- name: Test for log directory or link
|
||||
shell: |
|
||||
if [ -h "/var/log/aodh" ]; then
|
||||
|
|
|
@ -24,9 +24,7 @@ pre-start script
|
|||
mkdir -p "/var/lock/{{ program_name }}"
|
||||
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_name }}"
|
||||
|
||||
{% if aodh_venv_enabled | bool -%}
|
||||
. {{ aodh_bin }}/activate
|
||||
{%- endif %}
|
||||
|
||||
end script
|
||||
|
||||
|
|
Loading…
Reference in New Issue