Add support for using distribution packages for OpenStack services
Distributions provide packages for the OpenStack services so we add support for using these instead of the pip ones. Change-Id: Iab155254fa3600e1b6b3e8992f7c1fdc6f710ed6 Implements: blueprint openstack-distribution-packages
This commit is contained in:
parent
dbbeb264cf
commit
07d79cd0a0
@ -21,6 +21,9 @@ debug: False
|
||||
designate_package_state: "latest"
|
||||
designate_pip_package_state: "latest"
|
||||
|
||||
# Set installation method.
|
||||
designate_install_method: "source"
|
||||
|
||||
## The git source/branch
|
||||
designate_git_repo: https://git.openstack.org/openstack/designate
|
||||
designate_git_install_branch: master
|
||||
@ -36,13 +39,13 @@ designate_developer_constraints:
|
||||
|
||||
# Name of the virtual env to deploy into
|
||||
designate_venv_tag: untagged
|
||||
designate_bin: "/openstack/venvs/designate-{{ designate_venv_tag }}/bin"
|
||||
designate_bin: "{{ _designate_bin }}"
|
||||
|
||||
# Set the etc dir path where designate is installed.
|
||||
# This is used for role access to the db migrations.
|
||||
# Example:
|
||||
# designate_etc_dir: "/usr/local/etc/designate"
|
||||
designate_etc_dir: "{{ designate_bin | dirname }}/etc/designate"
|
||||
designate_etc_dir: "{{ _designate_etc }}/designate"
|
||||
|
||||
# venv_download, even when true, will use the fallback method of building the
|
||||
# venv from scratch if the venv download fails.
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The role now supports using the distribution packages for the OpenStack
|
||||
services instead of the pip ones. This feature is disabled by default
|
||||
and can be enabled by simply setting the ``designate_install_method``
|
||||
variable to ``distro``.
|
@ -13,9 +13,21 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Record the installation method
|
||||
ini_file:
|
||||
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
|
||||
section: "designate"
|
||||
option: "install_method"
|
||||
value: "{{ designate_install_method }}"
|
||||
|
||||
- name: Refresh local facts to ensure the designate section is present
|
||||
setup:
|
||||
filter: ansible_local
|
||||
gather_subset: "!all"
|
||||
|
||||
- name: Install designate distro packages
|
||||
package:
|
||||
name: "{{ designate_distro_packages }}"
|
||||
name: "{{ designate_package_list }}"
|
||||
state: "{{ designate_package_state }}"
|
||||
update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}"
|
||||
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
|
||||
@ -24,115 +36,6 @@
|
||||
retries: 5
|
||||
delay: 2
|
||||
|
||||
- name: Create developer mode constraint file
|
||||
copy:
|
||||
dest: "/opt/developer-pip-constraints.txt"
|
||||
content: |
|
||||
{% for item in designate_developer_constraints %}
|
||||
{{ item }}
|
||||
{% endfor %}
|
||||
when: designate_developer_mode | bool
|
||||
|
||||
- name: Install requires pip packages
|
||||
pip:
|
||||
name: "{{ designate_requires_pip_packages }}"
|
||||
state: "{{ designate_pip_package_state }}"
|
||||
extra_args: >-
|
||||
{{ designate_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
|
||||
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
|
||||
{{ pip_install_options | default('') }}
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
|
||||
- name: Retrieve checksum for venv download
|
||||
uri:
|
||||
url: "{{ designate_venv_download_url | replace('tgz', 'checksum') }}"
|
||||
return_content: yes
|
||||
register: designate_venv_checksum
|
||||
when: designate_venv_download | bool
|
||||
|
||||
- name: Attempt venv download
|
||||
get_url:
|
||||
url: "{{ designate_venv_download_url }}"
|
||||
dest: "/var/cache/{{ designate_venv_download_url | basename }}"
|
||||
checksum: "sha1:{{ designate_venv_checksum.content | trim }}"
|
||||
register: designate_get_venv
|
||||
when: designate_venv_download | bool
|
||||
|
||||
- name: Remove existing venv
|
||||
file:
|
||||
path: "{{ designate_bin | dirname }}"
|
||||
state: absent
|
||||
when: designate_get_venv | changed
|
||||
|
||||
- name: Create designate venv dir
|
||||
file:
|
||||
path: "{{ designate_bin | dirname }}"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
register: designate_venv_dir
|
||||
when: designate_get_venv | changed
|
||||
|
||||
- name: Unarchive pre-built venv
|
||||
unarchive:
|
||||
src: "/var/cache/{{ designate_venv_download_url | basename }}"
|
||||
dest: "{{ designate_bin | dirname }}"
|
||||
copy: "no"
|
||||
when: designate_get_venv | changed
|
||||
notify:
|
||||
- Restart designate services
|
||||
|
||||
- name: Install pip packages
|
||||
pip:
|
||||
name: "{{ designate_pip_packages }}"
|
||||
state: "{{ designate_pip_package_state }}"
|
||||
virtualenv: "{{ designate_bin | dirname }}"
|
||||
virtualenv_site_packages: "no"
|
||||
extra_args: >-
|
||||
{{ designate_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
|
||||
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
|
||||
{{ pip_install_options | default('') }}
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
when: designate_get_venv | failed or designate_get_venv | skipped
|
||||
notify:
|
||||
- Restart designate services
|
||||
|
||||
- name: Remove python from path first (CentOS, openSUSE)
|
||||
file:
|
||||
path: "{{ designate_bin | dirname }}/bin/python2.7"
|
||||
state: "absent"
|
||||
when:
|
||||
- ansible_pkg_mgr in ['yum', 'dnf', 'zypper']
|
||||
- not designate_developer_mode | bool
|
||||
- designate_get_venv | changed
|
||||
|
||||
# NOTE(odyssey4me):
|
||||
# We reinitialize the venv to ensure that the right
|
||||
# version of python is in the venv, but we do not
|
||||
# want virtualenv to also replace pip, setuptools
|
||||
# and wheel so we tell it not to.
|
||||
# We do not use --always-copy for CentOS/SuSE due
|
||||
# to https://github.com/pypa/virtualenv/issues/565
|
||||
- name: Update virtualenv path
|
||||
shell: |
|
||||
find {{ designate_bin }} -name \*.pyc -delete
|
||||
sed -si '1s/^.*python.*$/#!{{ designate_bin | replace ('/','\/') }}\/python/' {{ designate_bin }}/*
|
||||
virtualenv {{ designate_bin | dirname }} \
|
||||
{{ (ansible_pkg_mgr == 'apt') | ternary('--always-copy', '') }} \
|
||||
--no-pip \
|
||||
--no-setuptools \
|
||||
--no-wheel
|
||||
when: designate_get_venv | changed
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
- name: Record the venv tag deployed
|
||||
ini_file:
|
||||
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
|
||||
section: designate
|
||||
option: venv_tag
|
||||
value: "{{ designate_venv_tag }}"
|
||||
- name: Install designate packages from PIP
|
||||
include_tasks: designate_install_source.yml
|
||||
when: designate_install_method == 'source'
|
||||
|
128
tasks/designate_install_source.yml
Normal file
128
tasks/designate_install_source.yml
Normal file
@ -0,0 +1,128 @@
|
||||
---
|
||||
# Copyright 2018, SUSE LINUX GmbH.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Create developer mode constraint file
|
||||
copy:
|
||||
dest: "/opt/developer-pip-constraints.txt"
|
||||
content: |
|
||||
{% for item in designate_developer_constraints %}
|
||||
{{ item }}
|
||||
{% endfor %}
|
||||
when: designate_developer_mode | bool
|
||||
|
||||
- name: Install requires pip packages
|
||||
pip:
|
||||
name: "{{ designate_requires_pip_packages }}"
|
||||
state: "{{ designate_pip_package_state }}"
|
||||
extra_args: >-
|
||||
{{ designate_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
|
||||
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
|
||||
{{ pip_install_options | default('') }}
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
|
||||
- name: Retrieve checksum for venv download
|
||||
uri:
|
||||
url: "{{ designate_venv_download_url | replace('tgz', 'checksum') }}"
|
||||
return_content: yes
|
||||
register: designate_venv_checksum
|
||||
when: designate_venv_download | bool
|
||||
|
||||
- name: Attempt venv download
|
||||
get_url:
|
||||
url: "{{ designate_venv_download_url }}"
|
||||
dest: "/var/cache/{{ designate_venv_download_url | basename }}"
|
||||
checksum: "sha1:{{ designate_venv_checksum.content | trim }}"
|
||||
register: designate_get_venv
|
||||
when: designate_venv_download | bool
|
||||
|
||||
- name: Remove existing venv
|
||||
file:
|
||||
path: "{{ designate_bin | dirname }}"
|
||||
state: absent
|
||||
when: designate_get_venv | changed
|
||||
|
||||
- name: Create designate venv dir
|
||||
file:
|
||||
path: "{{ designate_bin | dirname }}"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
register: designate_venv_dir
|
||||
when: designate_get_venv | changed
|
||||
|
||||
- name: Unarchive pre-built venv
|
||||
unarchive:
|
||||
src: "/var/cache/{{ designate_venv_download_url | basename }}"
|
||||
dest: "{{ designate_bin | dirname }}"
|
||||
copy: "no"
|
||||
when: designate_get_venv | changed
|
||||
notify:
|
||||
- Restart designate services
|
||||
|
||||
- name: Install pip packages
|
||||
pip:
|
||||
name: "{{ designate_pip_packages }}"
|
||||
state: "{{ designate_pip_package_state }}"
|
||||
virtualenv: "{{ designate_bin | dirname }}"
|
||||
virtualenv_site_packages: "no"
|
||||
extra_args: >-
|
||||
{{ designate_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
|
||||
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
|
||||
{{ pip_install_options | default('') }}
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
when: designate_get_venv | failed or designate_get_venv | skipped
|
||||
notify:
|
||||
- Restart designate services
|
||||
|
||||
- name: Remove python from path first (CentOS, openSUSE)
|
||||
file:
|
||||
path: "{{ designate_bin | dirname }}/bin/python2.7"
|
||||
state: "absent"
|
||||
when:
|
||||
- ansible_pkg_mgr in ['yum', 'dnf', 'zypper']
|
||||
- not designate_developer_mode | bool
|
||||
- designate_get_venv | changed
|
||||
|
||||
# NOTE(odyssey4me):
|
||||
# We reinitialize the venv to ensure that the right
|
||||
# version of python is in the venv, but we do not
|
||||
# want virtualenv to also replace pip, setuptools
|
||||
# and wheel so we tell it not to.
|
||||
# We do not use --always-copy for CentOS/SuSE due
|
||||
# to https://github.com/pypa/virtualenv/issues/565
|
||||
- name: Update virtualenv path
|
||||
shell: |
|
||||
find {{ designate_bin }} -name \*.pyc -delete
|
||||
sed -si '1s/^.*python.*$/#!{{ designate_bin | replace ('/','\/') }}\/python/' {{ designate_bin }}/*
|
||||
virtualenv {{ designate_bin | dirname }} \
|
||||
{{ (ansible_pkg_mgr == 'apt') | ternary('--always-copy', '') }} \
|
||||
--no-pip \
|
||||
--no-setuptools \
|
||||
--no-wheel
|
||||
when: designate_get_venv | changed
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
|
||||
- name: Record the venv tag deployed
|
||||
ini_file:
|
||||
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
|
||||
section: designate
|
||||
option: venv_tag
|
||||
value: "{{ designate_venv_tag }}"
|
@ -13,6 +13,16 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Fail if service was deployed using a different installation method
|
||||
fail:
|
||||
msg: "Switching installation methods for OpenStack services is not supported"
|
||||
when:
|
||||
- ansible_local is defined
|
||||
- ansible_local.openstack_ansible is defined
|
||||
- ansible_local.openstack_ansible.designate is defined
|
||||
- ansible_local.openstack_ansible.designate.install_method is defined
|
||||
- ansible_local.openstack_ansible.designate.install_method != designate_install_method
|
||||
|
||||
- name: Gather variables for each operating system
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
@ -24,6 +34,11 @@
|
||||
tags:
|
||||
- always
|
||||
|
||||
- name: Gather variables for installation method
|
||||
include_vars: "{{ designate_install_method }}_install.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- include: designate_pre_install.yml
|
||||
tags:
|
||||
- designate-install
|
||||
|
@ -27,7 +27,6 @@ designate_rabbitmq_vhost: /designate
|
||||
designate_rabbitmq_servers: "{{ rabbitmq_servers }}"
|
||||
designate_rabbitmq_use_ssl: "{{ rabbitmq_use_ssl }}"
|
||||
designate_rabbitmq_port: "{{ rabbitmq_port }}"
|
||||
designate_bin: "/openstack/venvs/designate-{{ designate_venv_tag }}/bin"
|
||||
designate_pools_yaml:
|
||||
- name: "default"
|
||||
description: Default BIND9 Pool
|
||||
|
10
tox.ini
10
tox.ini
@ -101,6 +101,16 @@ commands =
|
||||
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
|
||||
|
||||
|
||||
[testenv:distro_install]
|
||||
deps =
|
||||
{[testenv:ansible]deps}
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
ANSIBLE_PARAMETERS=-e designate_install_method=distro
|
||||
commands =
|
||||
bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"
|
||||
|
||||
|
||||
[testenv:ssl]
|
||||
deps =
|
||||
{[testenv:ansible]deps}
|
||||
|
19
vars/distro_install.yml
Normal file
19
vars/distro_install.yml
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
# Copyright 2018, SUSE LINUX GmbH.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
designate_package_list: "{{ designate_distro_packages + designate_service_distro_packages }}"
|
||||
_designate_bin: "/usr/bin"
|
||||
_designate_etc: "/etc"
|
@ -16,3 +16,14 @@
|
||||
# Common yum packages
|
||||
designate_distro_packages:
|
||||
- which
|
||||
|
||||
designate_service_distro_packages:
|
||||
- openstack-designate-agent
|
||||
- openstack-designate-api
|
||||
- openstack-designate-central
|
||||
- openstack-designate-mdns
|
||||
- openstack-designate-pool-manager
|
||||
- openstack-designate-producer
|
||||
- openstack-designate-sink
|
||||
- openstack-designate-worker
|
||||
- openstack-designate-zone-manager
|
||||
|
19
vars/source_install.yml
Normal file
19
vars/source_install.yml
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
# Copyright 2018, SUSE LINUX GmbH.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
designate_package_list: "{{ designate_distro_packages }}"
|
||||
_designate_bin: "/openstack/venvs/designate-{{ designate_venv_tag }}/bin"
|
||||
_designate_etc: "{{ _designate_bin | dirname + '/etc' }}"
|
@ -1 +0,0 @@
|
||||
redhat-7.yml
|
27
vars/suse-42.yml
Normal file
27
vars/suse-42.yml
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
# Copyright 2018, SUSE LINUX GmbH.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Common yum packages
|
||||
designate_distro_packages:
|
||||
- which
|
||||
|
||||
designate_service_distro_packages:
|
||||
- openstack-designate
|
||||
- openstack-designate-agent
|
||||
- openstack-designate-api
|
||||
- openstack-designate-central
|
||||
- openstack-designate-producer
|
||||
- openstack-designate-sink
|
||||
- openstack-designate-worker
|
@ -18,3 +18,14 @@ cache_timeout: 600
|
||||
|
||||
# Common apt packages
|
||||
designate_distro_packages: []
|
||||
|
||||
designate_service_distro_packages:
|
||||
- designate
|
||||
- designate-agent
|
||||
- designate-api
|
||||
- designate-central
|
||||
- designate-pool-manager
|
||||
- designate-producer
|
||||
- designate-sink
|
||||
- designate-worker
|
||||
- designate-zone-manager
|
||||
|
@ -20,6 +20,11 @@
|
||||
- openstack-ansible-functional-opensuse-423
|
||||
- openstack-ansible-functional-ubuntu-xenial
|
||||
- openstack-ansible-designate-ssl-nv
|
||||
- openstack-ansible-functional-distro_install-ubuntu-xenial
|
||||
# NOTE(hwoarang) Centos7 is having some troubles with repo dependencies
|
||||
# so disabling until it's investigated.
|
||||
- openstack-ansible-functional-distro_install-centos-7-nv
|
||||
- openstack-ansible-functional-distro_install-opensuse-423
|
||||
experimental:
|
||||
jobs:
|
||||
- openstack-ansible-integrated-deploy-aio
|
||||
@ -29,3 +34,5 @@
|
||||
- openstack-ansible-functional-centos-7
|
||||
- openstack-ansible-functional-opensuse-423
|
||||
- openstack-ansible-functional-ubuntu-xenial
|
||||
- openstack-ansible-functional-distro_install-ubuntu-xenial
|
||||
- openstack-ansible-functional-distro_install-opensuse-423
|
||||
|
Loading…
x
Reference in New Issue
Block a user