Merge "Implement heat venv support"

This commit is contained in:
Jenkins 2015-10-15 11:25:02 +00:00 committed by Gerrit Code Review
commit 4c85fcc51d
8 changed files with 102 additions and 10 deletions

View File

@ -16,15 +16,25 @@
# The variables file used by the playbooks in the Heat-api group.
# These don't have to be explicitly imported by vars_files: they are autopopulated.
# Defines that the role will be deployed on a host machine
is_metal: true
# Enable/Disable Ceilometer
heat_ceilometer_enabled: False
## Verbosity Options
debug: False
verbose: True
# Name of the virtual env to deploy into
heat_venv_tag: untagged
heat_venv_bin: "/openstack/venvs/heat-{{ heat_venv_tag }}/bin"
# Set this to enable or disable installing in a venv
heat_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.
heat_bin: "{{ heat_venv_bin }}"
heat_fatal_deprecations: False
heat_clients_endpoint: internalURL
@ -144,6 +154,12 @@ heat_apt_packages:
- rsync
- libxslt1.1
# Heat packages that must be installed before anything else
heat_requires_pip_packages:
- virtualenv
- python-keystoneclient # Keystoneclient needed to OSA keystone lib
# Common pip packages
heat_pip_packages:
- keystonemiddleware
- PyMySQL

View File

@ -40,9 +40,10 @@
- heat-db-setup
- name: Perform a heat DB sync
command: heat-manage db_sync
command: "{{ heat_bin }}/heat-manage db_sync"
sudo: yes
sudo_user: "{{ heat_system_user_name }}"
tags:
- heat-db-sync
- heat-setup
- heat-command-bin

View File

@ -57,7 +57,8 @@
- name: Ensure heat user
shell: |
. {{ ansible_env.HOME }}/openrc
openstack --os-identity-api-version=3 \
{{ heat_bin }}/openstack \
--os-identity-api-version=3 \
--os-auth-url={{ keystone_service_adminurl_v3 }} \
--os-project-name={{ heat_project_name }} \
--os-project-domain-name={{ heat_project_domain_name }} \
@ -72,13 +73,16 @@
- heat-domain
- heat-domain-setup
- heat-config
- heat-command-bin
# TODO Change the keystone library to support adding
# a role to a user without specifying a project
- name: Assign admin role to heat domain admin user
shell: |
. {{ ansible_env.HOME }}/openrc
openstack --os-identity-api-version=3 \
{{ heat_bin }}/openstack \
--os-identity-api-version=3 \
--os-auth-url={{ keystone_service_adminurl_v3 }} \
--os-project-name={{ heat_project_name }} \
--os-project-domain-name={{ heat_project_domain_name }} \
@ -92,3 +96,4 @@
- heat-domain
- heat-domain-setup
- heat-config
- heat-command-bin

View File

@ -34,9 +34,43 @@
delay: 2
with_items: heat_apt_packages
tags:
- heat-install
- heat-apt-packages
- name: Install pip 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:
- "{{ heat_requires_pip_packages }}"
tags:
- heat-install
- heat-pip-packages
- name: Install pip packages (venv)
pip:
name: "{{ item }}"
state: present
virtualenv: "{{ heat_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:
- "{{ heat_pip_packages }}"
when: heat_venv_enabled | bool
tags:
- heat-install
- heat-pip-packages
- name: Install pip packages (no venv)
pip:
name: "{{ item }}"
state: present
@ -47,5 +81,7 @@
delay: 2
with_items:
- "{{ heat_pip_packages }}"
when: not heat_venv_enabled | bool
tags:
- heat-install
- heat-pip-packages

View File

@ -51,3 +51,19 @@
- Restart heat services
tags:
- heat-config
- name: Get heat command path
command: which heat
register: heat_command_path
when:
- not heat_venv_enabled | bool
tags:
- heat-command-bin
- name: Set heat command path
set_fact:
heat_bin: "{{ heat_command_path.stdout | dirname }}"
when:
- not heat_venv_enabled | bool
tags:
- heat-command-bin

View File

@ -41,6 +41,7 @@
group: "{{ item.group|default(heat_system_group_name) }}"
mode: "{{ item.mode|default('0755') }}"
with_items:
- { path: "/openstack", mode: "0755", owner: "root", group: "root" }
- { path: "/etc/heat" }
- { path: "/etc/heat/environment.d" }
- { path: "/etc/heat/templates" }
@ -50,6 +51,19 @@
tags:
- heat-dirs
- name: Create heat venv dir
file:
path: "{{ item.path }}"
state: directory
owner: "{{ item.owner|default(heat_system_user_name) }}"
group: "{{ item.group|default(heat_system_group_name) }}"
with_items:
- { path: "/openstack/venvs", mode: "0755", owner: "root", group: "root" }
- { path: "{{ heat_venv_bin }}" }
when: heat_venv_enabled | bool
tags:
- heat-dirs
- name: Create heat plugin dirs
file:
path: "{{ item }}"

View File

@ -15,13 +15,12 @@
- include: heat_pre_install.yml
- include: heat_install.yml
- include: heat_post_install.yml
- include: heat_domain_setup.yml
when: >
inventory_hostname == groups['heat_all'][0]
- include: heat_post_install.yml
- include: heat_db_setup.yml
when: >
inventory_hostname == groups['heat_all'][0]

View File

@ -12,7 +12,7 @@ respawn
respawn limit 10 5
# Set the RUNBIN environment variable
env RUNBIN="/usr/local/bin/{{ program_name }}"
env RUNBIN="{{ heat_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 heat_venv_enabled | bool -%}
. {{ heat_venv_bin }}/activate
{%- endif %}
end script
# Post stop actions