Merge "Implement glance venv support"

This commit is contained in:
Jenkins 2015-10-14 22:09:04 +00:00 committed by Gerrit Code Review
commit 62d5bf6c1a
7 changed files with 115 additions and 29 deletions

View File

@ -86,7 +86,11 @@
tags:
- glance-logs
roles:
- { role: "os_glance", tags: [ "os-glance" ] }
- role: "os_glance"
glance_galera_address: "{{ galera_address }}"
glance_venv_tag: "{{ openstack_release }}"
tags:
- "os-glance"
- { role: "openstack_openrc", tags: [ "openstack-openrc" ] }
- role: "ceph_client"
openstack_service_system_user: "{{ glance_system_user_name }}"
@ -105,6 +109,5 @@
- "system-crontab-coordination"
vars:
galera_address: "{{ internal_lb_vip_address }}"
glance_galera_address: "{{ internal_lb_vip_address }}"
ansible_hostname: "{{ container_name }}"
is_metal: "{{ properties.is_metal|default(false) }}"

View File

@ -13,15 +13,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Defines that the role will be deployed on a host machine
is_metal: true
## Verbosity Options
debug: False
verbose: True
# Name of the virtual env to deploy into
glance_venv_tag: untagged
glance_venv_bin: "/openstack/venvs/glance-{{ glance_venv_tag }}/bin"
# Set this to enable or disable installing in a venv
glance_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.
glance_bin: "{{ glance_venv_bin }}"
# Enable/Disable Ceilometer
glance_ceilometer_enabled: False
## Verbosity Options
debug: False
verbose: True
glance_profiler_enabled: False
glance_fatal_deprecations: False
@ -154,6 +164,11 @@ glance_apt_packages:
- git
- nfs-common
# Cinder packages that must be installed before anything else
glance_requires_pip_packages:
- virtualenv
- python-keystoneclient # Keystoneclient needed to OSA keystone lib
# Common pip packages
glance_pip_packages:
- glance

View File

@ -40,9 +40,10 @@
- glance-db-setup
- name: Perform a Glance DB sync
command: glance-manage db_sync
command: "{{ glance_bin }}/glance-manage db_sync"
sudo: yes
sudo_user: "{{ glance_system_user_name }}"
tags:
- glance-db-sync
- glance-setup
- glance-command-bin

View File

@ -37,7 +37,40 @@
- glance-install
- glance-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:
- "{{ glance_requires_pip_packages }}"
tags:
- glance-install
- glance-pip-packages
- name: Install pip packages (venv)
pip:
name: "{{ item }}"
state: present
virtualenv: "{{ glance_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:
- "{{ glance_pip_packages }}"
when: glance_venv_enabled | bool
tags:
- glance-install
- glance-pip-packages
- name: Install pip packages (no venv)
pip:
name: "{{ item }}"
state: present
@ -48,6 +81,7 @@
delay: 2
with_items:
- "{{ glance_pip_packages }}"
when: not glance_venv_enabled | bool
tags:
- glance-install
- glance-pip-packages

View File

@ -13,25 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Create glance cache management cron jobs
cron:
name: "{{ item.name }}"
minute: "{{ 59 |random(start=1) }}"
day: "*"
hour: "{{ item.hour }}"
month: "*"
state: present
job: "{{ item.name }}"
user: glance
with_items:
- name: /usr/local/bin/glance-cache-pruner
hour: "*"
- name: /usr/local/bin/glance-cache-cleaner
hour: "*/5"
when: glance_flavor | search("cache")
tags:
- glance-cron
- name: Drop Glance Config(s)
config_template:
src: "{{ item.src }}"
@ -112,3 +93,38 @@
tags:
- glance-nfs
- glance-nfs-local-path
- name: Get glance command path
command: which glance
register: glance_command_path
when:
- not glance_venv_enabled | bool
tags:
- glance-command-bin
- name: Set glance command path
set_fact:
glance_bin: "{{ glance_command_path.stdout | dirname }}"
when:
- not glance_venv_enabled | bool
tags:
- glance-command-bin
- name: Create glance cache management cron jobs
cron:
name: "{{ item.name }}"
minute: "{{ 59 |random(start=1) }}"
day: "*"
hour: "{{ item.hour }}"
month: "*"
state: present
job: "{{ item.name }}"
user: glance
with_items:
- name: "{{ glance_bin }}/glance-cache-pruner"
hour: "*"
- name: "{{ glance_bin }}/glance-cache-cleaner"
hour: "*/5"
when: glance_flavor | search("cache")
tags:
- glance-cron

View File

@ -41,6 +41,7 @@
group: "{{ item.group|default(glance_system_group_name) }}"
mode: "{{ item.mode|default('0755') }}"
with_items:
- { path: "/openstack", mode: "0755", owner: "root", group: "root" }
- { path: "/etc/glance" }
- { path: "/etc/sudoers.d", mode: "0755", owner: "root", group: "root" }
- { path: "/var/cache/glance" }
@ -52,6 +53,17 @@
tags:
- glance-dirs
- name: Create glance venv dir
file:
path: "{{ item.path }}"
state: directory
with_items:
- { path: "/openstack/venvs" }
- { path: "{{ glance_venv_bin }}" }
when: glance_venv_enabled | bool
tags:
- glance-dirs
- name: Test for log directory or link
shell: |
if [ -h "/var/log/glance" ]; then

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="{{ glance_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 glance_venv_enabled | bool -%}
. {{ glance_venv_bin }}/activate
{%- endif %}
end script
# Post stop actions