Add haproxy install playbook

In order to effectively test rolling upgrades, haproxy
will need to be installed to facilitate the services
being online while the upgrades are happening.

The common task to manage the backend when doing
rolling upgrades is included.

The keystone install playbook makes use of them both
in order to facilitate the rolling upgrades.

Change-Id: I5cbb3824430dc09b36476f81e0cdfd4f0a15f497
This commit is contained in:
Jesse Pretorius 2017-06-07 15:42:04 +01:00 committed by Jesse Pretorius (odyssey4me)
parent 48b08010a5
commit 0a500c1abe
4 changed files with 91 additions and 6 deletions

View File

@ -0,0 +1,30 @@
---
# Copyright 2017, Logan Vig <logan2211@gmail.com>
#
# 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: Set haproxy service state
haproxy:
socket: /var/run/haproxy.stat
backend: "{{ haproxy_backend | default(omit) }}"
host: "{{ inventory_hostname }}"
state: "{{ haproxy_state | default('enabled') }}"
shutdown_sessions: "{{ haproxy_shutdown_sessions | default(False) | bool }}"
wait: "{{ haproxy_wait | default(False) | bool }}"
wait_interval: "{{ haproxy_wait_interval | default(5) }}"
wait_retries: "{{ haproxy_wait_retries | default(24) }}"
weight: "{{ haproxy_weight | default(omit) }}"
delegate_to: "{{ item }}"
with_items: "{{ groups['haproxy'] }}"
tags:
- common-haproxy

23
test-install-haproxy.yml Normal file
View File

@ -0,0 +1,23 @@
---
# Copyright 2017, Rackspace US, Inc.
#
# 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: Install haproxy
hosts: localhost
become: true
roles:
- role: "haproxy_server"
haproxy_service_configs: "{{ haproxy_default_services | default([]) }}"
vars_files:
- test-vars.yml

View File

@ -13,12 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Playbook for deploying keystone
hosts: keystone_all
- name: Prepare MQ/DB services
hosts: keystone_all[0]
gather_facts: true
user: root
become: true
gather_facts: true
pre_tasks:
tasks:
- name: Set keystone_messaging fact
set_fact:
keystone_messaging_enabled: "{{ groups['rabbitmq_all'] is defined }}"
@ -30,7 +30,35 @@
- include: create-grant-db.yml
db_name: "{{ keystone_galera_database }}"
db_password: "{{ keystone_container_mysql_password }}"
roles:
- role: "{{ keystone_rolename | default('os_keystone') }}"
vars_files:
- test-vars.yml
- name: Playbook for deploying keystone
hosts: keystone_all
serial: 1
user: root
become: true
gather_facts: true
pre_tasks:
# In order to ensure that any container, software or
# config file changes which causes a container/service
# restart do not cause an unexpected outage, we drain
# the load balancer back end for this container.
- include: common-tasks/haproxy-endpoint-manage.yml
vars:
haproxy_state: disabled
when:
- "groups['keystone_all'] | length > 1"
roles:
- role: "os_keystone"
post_tasks:
# Now that container changes are done, we can set
# the load balancer back end for this container
# to available again.
- include: common-tasks/haproxy-endpoint-manage.yml
vars:
haproxy_state: enabled
when:
- "groups['keystone_all'] | length > 1"
vars_files:
- test-vars.yml

View File

@ -493,3 +493,7 @@ development_repo_directory: "{{ lookup('env', 'OPENSTACK_REPO_DIRECTORY') | defa
lxc_container_bind_mounts:
- host_directory: "{{ development_repo_directory }}"
container_directory: "{{ development_repo_directory }}"
## haproxy variables
haproxy_ssl: no