Enable 'developer mode' installation

This commit adds the ability to install glance without requiring an
OpenStack-Ansible pip wheel repository.

In 'developer mode' the git source is cloned directly and the services
are installed directly from the git clone with its requirements being
installed from pypi. The OpenStack upper-constraints file is also used
to ensure that the install is executed using the appropriately tested
set of pypi packages.

The following variables are added:

 - designate_developer_mode: A boolean switch to enable/disable developer
   mode.
 - designate_git_repo: The git repository to clone Designate from.
 - designate_git_install_branch: The branch, tag or SHA to checkout once
   the designate repository has been cloned.
 - designate_requirements_git_repo: The git repository to clone in order
   to retrieve the upper-constraints file.
 - designate_requirements_git_install_branch: The branch, tag or SHA to
   checkout once the requirements repository has been cloned.

The testing playbook overrides the *_install_branch variables to fixed
SHA's in order to fix points in time at which updates are made. This
reduces the effect of upstream development changes on the
OpenStack-Ansible development cycle.
This commit is contained in:
Jesse Pretorius
2016-03-11 11:03:07 +00:00
parent aa9ae16f9e
commit 5a53c622b7
4 changed files with 71 additions and 21 deletions

View File

@@ -17,6 +17,17 @@
debug: False
verbose: True
# These variables are used in 'developer mode' in order to allow the role
# to build an environment directly from a git source without the presence
# of an OpenStack-Ansible repo_server.
designate_git_repo: https://git.openstack.org/openstack/designate
designate_git_install_branch: master
designate_requirements_git_repo: https://git.openstack.org/openstack/requirements
designate_requirements_git_install_branch: master
designate_developer_mode: false
designate_developer_constraints:
- "git+{{ designate_git_repo }}@{{ designate_git_install_branch }}#egg=designate"
# Name of the virtual env to deploy into
designate_venv_tag: untagged
designate_venv_bin: "/openstack/venvs/designate-{{ designate_venv_tag }}/bin"

View File

@@ -33,5 +33,6 @@ dependencies:
- apt_package_pinning
- galera_client
- openstack_openrc
- pip_lock_down
- role: pip_lock_down
when:
- not designate_developer_mode | bool

View File

@@ -37,17 +37,39 @@
- designate-install
- designate-apt-packages
- name: Install 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:
- "{{ designate_pip_packages }}"
- name: Create developer mode constraint file
copy:
dest: "/opt/developer-pip-constraints.txt"
content: |
{% for item in glance_developer_constraints %}
{{ item }}
{% endfor %}
when:
- designate_developer_mode | bool
tags:
- designate-install
- designate-pip-packages
- name: Clone requirements git repository
git:
repo: "{{ designate_requirements_git_repo }}"
dest: "/opt/requirements"
clone: yes
update: yes
version: "{{ designate_requirements_git_install_branch }}"
when:
- designate_developer_mode | bool
tags:
- designate-install
- designate-pip-packages
- name: Add constraints to pip_install_options fact for developer mode
set_fact:
pip_install_options: "{{ pip_install_options|default('') }} --constraint /opt/developer-pip-constraints.txt --constraint /opt/requirements/upper-constraints.txt"
when:
- designate_developer_mode | bool
- "'/opt/developer-pip-constraints.txt' not in pip_install_options|default('')"
- "'/opt/requirements/upper-constraints.txt' not in pip_install_options|default('')"
tags:
- designate-install
- designate-pip-packages
@@ -71,7 +93,9 @@
stat:
path: "/var/cache/{{ designate_venv_download_url | basename }}"
get_md5: False
when: designate_venv_enabled | bool
when:
- not designate_developer_mode | bool
- designate_venv_enabled | bool
register: local_venv_stat
tags:
- designate-install
@@ -81,12 +105,19 @@
uri:
url: "{{ designate_venv_download_url | replace('tgz', 'checksum') }}"
return_content: True
when: designate_venv_enabled | bool
when:
- not designate_developer_mode | bool
- designate_venv_enabled | bool
register: remote_venv_checksum
tags:
- designate-install
- designate-pip-packages
# TODO: When project moves to ansible 2 we can pass this a sha256sum which will:
# a) allow us to remove force: yes
# b) allow the module to calculate the checksum of dest file which would
# result in file being downloaded only if provided and dest sha256sum
# checksums differ
- name: Attempt venv download
get_url:
url: "{{ designate_venv_download_url }}"
@@ -95,6 +126,7 @@
ignore_errors: true
register: get_venv
when:
- not designate_developer_mode | bool
- designate_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 }})
@@ -126,6 +158,7 @@
path: "{{ designate_venv_bin | dirname }}"
state: directory
when:
- not designate_developer_mode | bool
- designate_venv_enabled | bool
- designate_get_venv | changed
tags:
@@ -138,6 +171,7 @@
dest: "{{ designate_venv_bin | dirname }}"
copy: "no"
when:
- not designate_developer_mode | bool
- designate_venv_enabled | bool
- designate_get_venv | changed
notify:
@@ -150,6 +184,7 @@
command: >
virtualenv-tools --update-path=auto {{ designate_venv_bin | dirname }}
when:
- not designate_developer_mode | bool
- designate_venv_enabled | bool
- designate_get_venv | success
tags:
@@ -167,11 +202,10 @@
until: install_packages|success
retries: 5
delay: 2
with_items:
- "{{ designate_pip_packages }}"
with_items: designate_pip_packages
when:
- designate_venv_enabled | bool
- designate_get_venv | failed
- designate_get_venv | failed or designate_developer_mode | bool
notify:
- Restart designate services
tags:
@@ -190,7 +224,9 @@
delay: 2
with_items:
- "{{ designate_pip_packages }}"
when: not designate_venv_enabled | bool
when:
- not designate_venv_enabled | bool
- not designate_developer_mode | bool
notify:
- Restart designate services
tags:

View File

@@ -195,7 +195,8 @@
keystone_galera_database: keystone
keystone_venv_tag: "testing"
keystone_developer_mode: true
keystone_git_install_branch: a55128044f763f5cfe2fdc57c738eaca97636448
keystone_git_install_branch: a55128044f763f5cfe2fdc57c738eaca97636448 # HEAD of "master" as of 17.01.2016
keystone_requirements_git_install_branch: 332278d456e06870150835564342570ec9d5f5a0 # HEAD of "master" as of 17.01.2016
keystone_auth_admin_token: "SuperSecreteTestToken"
keystone_auth_admin_password: "SuperSecretePassword"
keystone_service_password: "secrete"
@@ -290,7 +291,8 @@
keystone_service_adminurl: "{{ keystone_service_adminuri }}/v3"
designate_venv_tag: "testing"
designate_developer_mode: true
designate_git_install_branch: 7d5c3710ce2739a8ac356208d4e104f2ce3ec9ab
designate_git_install_branch: 4df88d7b28a05cb3556573ce4f1c7c66abf944bb # HEAD of "master" as of 17.01.2016
designate_requirements_git_install_branch: 332278d456e06870150835564342570ec9d5f5a0 # HEAD of "master" as of 17.01.2016
designate_service_password: "secrete"
designate_profiler_hmac_key: "secrete"
openrc_os_password: "{{ keystone_auth_admin_password }}"