Implement aodh venv support
This commit conditionally allows the os_aodh role to install build and deploy within a venv. This is the new default behavior of the role however the functionality can be disabled. Change-Id: I9f9e09b2a68e843da1d92a782cd29fc563379a6d Implements: blueprint enable-venv-support-within-the-roles Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
cf335efa89
commit
b0cdb0de46
@ -61,7 +61,10 @@
|
||||
- aodh-logs
|
||||
- aodh-log-dirs
|
||||
roles:
|
||||
- { role: "os_aodh", tags: [ "os-aodh" ] }
|
||||
- role: "os_aodh"
|
||||
aodh_venv_tag: "{{ openstack_release }}"
|
||||
tags:
|
||||
- "os-aodh"
|
||||
- { role: "openstack_openrc", tags: [ "openstack-openrc" ] }
|
||||
- role: "rsyslog_client"
|
||||
rsyslog_client_log_rotate_file: aodh_log_rotate
|
||||
|
@ -17,6 +17,18 @@
|
||||
debug: False
|
||||
verbose: False
|
||||
|
||||
# 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 }}"
|
||||
|
||||
## System info
|
||||
aodh_system_user_name: aodh
|
||||
aodh_system_group_name: aodh
|
||||
@ -70,6 +82,11 @@ aodh_service_adminurl: "{{ aodh_service_adminuri }}"
|
||||
aodh_apt_packages:
|
||||
- rpcbind
|
||||
|
||||
# aodh packages that must be installed before anything else
|
||||
aodh_requires_pip_packages:
|
||||
- virtualenv
|
||||
- python-keystoneclient # Keystoneclient needed to OSA keystone lib
|
||||
|
||||
# Common pip packages
|
||||
aodh_pip_packages:
|
||||
- aodh
|
||||
|
@ -25,10 +25,43 @@
|
||||
delay: 2
|
||||
with_items: aodh_apt_packages
|
||||
tags:
|
||||
- aodh-install
|
||||
- aodh-apt-packages
|
||||
|
||||
- name: Install requires pip packages
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
extra_args: "{{ pip_install_options|default('') }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items:
|
||||
- "{{ aodh_requires_pip_packages }}"
|
||||
tags:
|
||||
- aodh-install
|
||||
- aodh-pip-packages
|
||||
|
||||
- name: Install pip packages
|
||||
- name: Install pip packages (venv)
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
virtualenv: "{{ aodh_venv_bin | dirname }}"
|
||||
virtualenv_site_packages: "no"
|
||||
extra_args: "{{ pip_install_options|default('') }}"
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items:
|
||||
- "{{ aodh_pip_packages }}"
|
||||
when: aodh_venv_enabled | bool
|
||||
tags:
|
||||
- aodh-install
|
||||
- aodh-pip-packages
|
||||
|
||||
- name: Install pip packages (no venv)
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
@ -39,5 +72,7 @@
|
||||
delay: 2
|
||||
with_items:
|
||||
- "{{ aodh_pip_packages }}"
|
||||
when: not aodh_venv_enabled | bool
|
||||
tags:
|
||||
- aodh-install
|
||||
- aodh-pip-packages
|
||||
|
@ -13,6 +13,22 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Get aodh command path
|
||||
command: which aodh
|
||||
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 }}"
|
||||
@ -39,4 +55,3 @@
|
||||
tags:
|
||||
- aodh-config
|
||||
- aodh-post-install
|
||||
|
||||
|
@ -48,6 +48,17 @@
|
||||
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
|
||||
|
@ -12,7 +12,7 @@ respawn
|
||||
respawn limit 10 5
|
||||
|
||||
# Set the RUNBIN environment variable
|
||||
env RUNBIN="/usr/local/bin/{{ program_name }}"
|
||||
env RUNBIN="{{ aodh_bin }}/{{ program_name }}"
|
||||
|
||||
# Change directory to service users home
|
||||
chdir "{{ service_home }}"
|
||||
@ -24,6 +24,11 @@ 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
|
||||
|
||||
# Post stop actions
|
||||
|
Loading…
x
Reference in New Issue
Block a user