Allow disabling keepalived for external LBs

In some cases a deployer may want to use haproxy for SSL termination but
has external infrastructure for load balancing, and thus no need for
keepalived to manage the VIP.

Co-Authored-By: Adam Harwell <flux.adam@gmail.com>

Change-Id: I451d7e33f1e631038a8d198dbc33c9a8850571b7
This commit is contained in:
Clint Byrum 2018-02-18 23:09:16 -08:00 committed by Adam Harwell
parent 2866704aa0
commit a05e77d71a
5 changed files with 20 additions and 3 deletions

View File

@ -392,6 +392,7 @@ openstack_interface: "admin"
# could disable some of these required roles and run their own services.
enable_glance: "yes"
enable_haproxy: "yes"
enable_keepalived: "{{ enable_haproxy | bool }}"
enable_keystone: "yes"
enable_mariadb: "yes"
enable_memcached: "yes"

View File

@ -16,7 +16,7 @@ haproxy_services:
keepalived:
container_name: keepalived
group: haproxy
enabled: true
enabled: "{{ enable_keepalived | bool }}"
image: "{{ keepalived_image_full }}"
privileged: True
volumes:

View File

@ -5,7 +5,8 @@
with_items:
- { name: "net.ipv4.ip_nonlocal_bind", value: 1}
- { name: "net.unix.max_dgram_qlen", value: 128}
when: set_sysctl | bool
when:
- set_sysctl | bool
- name: Ensuring config directories exist
file:

View File

@ -11,12 +11,16 @@
changed_when: False
check_mode: no
run_once: true
when:
- enable_keepalived | bool
- name: Create empty temp kolla_keepalived_running file
local_action: copy content=None dest=/tmp/kolla_keepalived_running mode=0644
changed_when: False
check_mode: no
run_once: true
when:
- enable_keepalived | bool
- name: Getting hosts who is running keepalived
local_action: copy content={{ ansible_hostname }} dest=/tmp/kolla_keepalived_running mode=0644
@ -25,17 +29,21 @@
when:
- inventory_hostname in groups['haproxy']
- container_facts['keepalived'] is defined
- enable_haproxy | bool
- enable_keepalived | bool
- name: Registering host running keepalived
set_fact:
host_running_keepalived: "{{ lookup('file', '/tmp/kolla_keepalived_running') }}"
when:
- enable_keepalived | bool
- name: Clearing temp kolla_keepalived_running file
local_action: file path=/tmp/kolla_keepalived_running state=absent
changed_when: False
check_mode: no
run_once: true
when:
- enable_keepalived | bool
- name: Clearing temp kolla_haproxy_running file
local_action: file path=/tmp/kolla_haproxy_running state=absent
@ -103,6 +111,7 @@
- "{{ kolla_internal_vip_address }}"
- "{{ kolla_external_vip_address }}"
when:
- enable_keepalived | bool
- "host_running_keepalived == 'None'"
- enable_haproxy | bool
@ -128,6 +137,7 @@
kolla_internal_vip_address | ipaddr(ip_addr_output.stdout.split()[3]) is none)
when:
- enable_haproxy | bool
- enable_keepalived | bool
- container_facts['keepalived'] is not defined
- inventory_hostname in groups['haproxy']

View File

@ -0,0 +1,5 @@
---
features:
- |
Add a configuration option `enable_keepalived` to allow disabling the
service. This is useful when using an external LB in front of HAProxy.