Rename role haproxy to loadbalancer
For now role haproxy is maintaining haproxy and keepalived. In follow-up changes there is also proxysql added. This patch is *only* renaming/moving stuff to more prominent role loadbalancer, and moving also specific templates to subdirectory. This was done only to better diff in follow-up changes. Change-Id: I1d39d5bcaefc4016983bf267a2736b742cc3a555
This commit is contained in:
parent
a98076f11c
commit
ffd53512af
@ -576,6 +576,7 @@ enable_openstack_core: "yes"
|
|||||||
enable_glance: "{{ enable_openstack_core | bool }}"
|
enable_glance: "{{ enable_openstack_core | bool }}"
|
||||||
enable_haproxy: "yes"
|
enable_haproxy: "yes"
|
||||||
enable_keepalived: "{{ enable_haproxy | bool }}"
|
enable_keepalived: "{{ enable_haproxy | bool }}"
|
||||||
|
enable_loadbalancer: "{{ enable_haproxy | bool or enable_keepalived | bool }}"
|
||||||
enable_keystone: "{{ enable_openstack_core | bool }}"
|
enable_keystone: "{{ enable_openstack_core | bool }}"
|
||||||
enable_keystone_federation: "{{ (keystone_identity_providers | length > 0) and (keystone_identity_mappings | length > 0) }}"
|
enable_keystone_federation: "{{ (keystone_identity_providers | length > 0) and (keystone_identity_mappings | length > 0) }}"
|
||||||
enable_mariadb: "yes"
|
enable_mariadb: "yes"
|
||||||
|
@ -75,9 +75,15 @@ control
|
|||||||
[hacluster-remote:children]
|
[hacluster-remote:children]
|
||||||
compute
|
compute
|
||||||
|
|
||||||
[haproxy:children]
|
[loadbalancer:children]
|
||||||
network
|
network
|
||||||
|
|
||||||
|
[keepalived:children]
|
||||||
|
loadbalancer
|
||||||
|
|
||||||
|
[haproxy:children]
|
||||||
|
loadbalancer
|
||||||
|
|
||||||
[mariadb:children]
|
[mariadb:children]
|
||||||
control
|
control
|
||||||
|
|
||||||
|
@ -99,9 +99,15 @@ control
|
|||||||
[hacluster-remote:children]
|
[hacluster-remote:children]
|
||||||
compute
|
compute
|
||||||
|
|
||||||
[haproxy:children]
|
[loadbalancer:children]
|
||||||
network
|
network
|
||||||
|
|
||||||
|
[keepalived:children]
|
||||||
|
loadbalancer
|
||||||
|
|
||||||
|
[haproxy:children]
|
||||||
|
loadbalancer
|
||||||
|
|
||||||
[mariadb:children]
|
[mariadb:children]
|
||||||
control
|
control
|
||||||
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
---
|
|
||||||
- include_tasks: "{{ kolla_action }}.yml"
|
|
||||||
when: inventory_hostname in groups['haproxy']
|
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
project_name: "haproxy"
|
project_name: "loadbalancer"
|
||||||
|
|
||||||
haproxy_services:
|
loadbalancer_services:
|
||||||
haproxy:
|
haproxy:
|
||||||
container_name: haproxy
|
container_name: haproxy
|
||||||
group: haproxy
|
group: haproxy
|
||||||
@ -13,7 +13,7 @@ haproxy_services:
|
|||||||
healthcheck: "{{ haproxy_healthcheck }}"
|
healthcheck: "{{ haproxy_healthcheck }}"
|
||||||
keepalived:
|
keepalived:
|
||||||
container_name: keepalived
|
container_name: keepalived
|
||||||
group: haproxy
|
group: keepalived
|
||||||
enabled: "{{ enable_keepalived | bool }}"
|
enabled: "{{ enable_keepalived | bool }}"
|
||||||
image: "{{ keepalived_image_full }}"
|
image: "{{ keepalived_image_full }}"
|
||||||
privileged: True
|
privileged: True
|
@ -49,7 +49,7 @@
|
|||||||
- name: Restart backup haproxy container
|
- name: Restart backup haproxy container
|
||||||
vars:
|
vars:
|
||||||
service_name: "haproxy"
|
service_name: "haproxy"
|
||||||
service: "{{ haproxy_services[service_name] }}"
|
service: "{{ loadbalancer_services[service_name] }}"
|
||||||
become: true
|
become: true
|
||||||
kolla_docker:
|
kolla_docker:
|
||||||
action: "recreate_or_restart_container"
|
action: "recreate_or_restart_container"
|
||||||
@ -78,7 +78,7 @@
|
|||||||
- name: Start backup keepalived container
|
- name: Start backup keepalived container
|
||||||
vars:
|
vars:
|
||||||
service_name: "keepalived"
|
service_name: "keepalived"
|
||||||
service: "{{ haproxy_services[service_name] }}"
|
service: "{{ loadbalancer_services[service_name] }}"
|
||||||
become: true
|
become: true
|
||||||
kolla_docker:
|
kolla_docker:
|
||||||
action: "recreate_or_restart_container"
|
action: "recreate_or_restart_container"
|
||||||
@ -128,7 +128,7 @@
|
|||||||
- name: Start master haproxy container
|
- name: Start master haproxy container
|
||||||
vars:
|
vars:
|
||||||
service_name: "haproxy"
|
service_name: "haproxy"
|
||||||
service: "{{ haproxy_services[service_name] }}"
|
service: "{{ loadbalancer_services[service_name] }}"
|
||||||
become: true
|
become: true
|
||||||
kolla_docker:
|
kolla_docker:
|
||||||
action: "recreate_or_restart_container"
|
action: "recreate_or_restart_container"
|
||||||
@ -157,7 +157,7 @@
|
|||||||
- name: Start master keepalived container
|
- name: Start master keepalived container
|
||||||
vars:
|
vars:
|
||||||
service_name: "keepalived"
|
service_name: "keepalived"
|
||||||
service: "{{ haproxy_services[service_name] }}"
|
service: "{{ loadbalancer_services[service_name] }}"
|
||||||
become: true
|
become: true
|
||||||
kolla_docker:
|
kolla_docker:
|
||||||
action: "recreate_or_restart_container"
|
action: "recreate_or_restart_container"
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: Check haproxy containers
|
- name: Check loadbalancer containers
|
||||||
become: true
|
become: true
|
||||||
kolla_docker:
|
kolla_docker:
|
||||||
action: "compare_container"
|
action: "compare_container"
|
||||||
@ -13,6 +13,6 @@
|
|||||||
when:
|
when:
|
||||||
- inventory_hostname in groups[item.value.group]
|
- inventory_hostname in groups[item.value.group]
|
||||||
- item.value.enabled | bool
|
- item.value.enabled | bool
|
||||||
with_dict: "{{ haproxy_services }}"
|
with_dict: "{{ loadbalancer_services }}"
|
||||||
notify:
|
notify:
|
||||||
- "Restart {{ item.key }} container"
|
- "Restart {{ item.key }} container"
|
@ -10,11 +10,11 @@
|
|||||||
when:
|
when:
|
||||||
- inventory_hostname in groups[item.value.group]
|
- inventory_hostname in groups[item.value.group]
|
||||||
- item.value.enabled | bool
|
- item.value.enabled | bool
|
||||||
with_dict: "{{ haproxy_services }}"
|
with_dict: "{{ loadbalancer_services }}"
|
||||||
|
|
||||||
- name: Ensuring service config subdir exists
|
- name: Ensuring haproxy service config subdir exists
|
||||||
vars:
|
vars:
|
||||||
service: "{{ haproxy_services['haproxy'] }}"
|
service: "{{ loadbalancer_services['haproxy'] }}"
|
||||||
file:
|
file:
|
||||||
path: "{{ node_config_directory }}/haproxy/services.d"
|
path: "{{ node_config_directory }}/haproxy/services.d"
|
||||||
state: "directory"
|
state: "directory"
|
||||||
@ -28,20 +28,20 @@
|
|||||||
|
|
||||||
- name: Copying over config.json files for services
|
- name: Copying over config.json files for services
|
||||||
template:
|
template:
|
||||||
src: "{{ item.key }}.json.j2"
|
src: "{{ item.key }}/{{ item.key }}.json.j2"
|
||||||
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
|
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
|
||||||
mode: "0660"
|
mode: "0660"
|
||||||
become: true
|
become: true
|
||||||
when:
|
when:
|
||||||
- inventory_hostname in groups[item.value.group]
|
- inventory_hostname in groups[item.value.group]
|
||||||
- item.value.enabled | bool
|
- item.value.enabled | bool
|
||||||
with_dict: "{{ haproxy_services }}"
|
with_dict: "{{ loadbalancer_services }}"
|
||||||
notify:
|
notify:
|
||||||
- "Restart {{ item.key }} container"
|
- "Restart {{ item.key }} container"
|
||||||
|
|
||||||
- name: Copying over haproxy.cfg
|
- name: Copying over haproxy.cfg
|
||||||
vars:
|
vars:
|
||||||
service: "{{ haproxy_services['haproxy'] }}"
|
service: "{{ loadbalancer_services['haproxy'] }}"
|
||||||
template:
|
template:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
dest: "{{ node_config_directory }}/haproxy/haproxy.cfg"
|
dest: "{{ node_config_directory }}/haproxy/haproxy.cfg"
|
||||||
@ -53,13 +53,13 @@
|
|||||||
with_first_found:
|
with_first_found:
|
||||||
- "{{ node_custom_config }}/haproxy/{{ inventory_hostname }}/haproxy_main.cfg"
|
- "{{ node_custom_config }}/haproxy/{{ inventory_hostname }}/haproxy_main.cfg"
|
||||||
- "{{ node_custom_config }}/haproxy/haproxy_main.cfg"
|
- "{{ node_custom_config }}/haproxy/haproxy_main.cfg"
|
||||||
- "haproxy_main.cfg.j2"
|
- "haproxy/haproxy_main.cfg.j2"
|
||||||
notify:
|
notify:
|
||||||
- Restart haproxy container
|
- Restart haproxy container
|
||||||
|
|
||||||
- name: Copying over custom haproxy services configuration
|
- name: Copying over custom haproxy services configuration
|
||||||
vars:
|
vars:
|
||||||
service: "{{ haproxy_services['haproxy'] }}"
|
service: "{{ loadbalancer_services['haproxy'] }}"
|
||||||
template:
|
template:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
dest: "{{ node_config_directory }}/haproxy/services.d/"
|
dest: "{{ node_config_directory }}/haproxy/services.d/"
|
||||||
@ -75,7 +75,7 @@
|
|||||||
|
|
||||||
- name: Copying over keepalived.conf
|
- name: Copying over keepalived.conf
|
||||||
vars:
|
vars:
|
||||||
service: "{{ haproxy_services['keepalived'] }}"
|
service: "{{ loadbalancer_services['keepalived'] }}"
|
||||||
template:
|
template:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
dest: "{{ node_config_directory }}/keepalived/keepalived.conf"
|
dest: "{{ node_config_directory }}/keepalived/keepalived.conf"
|
||||||
@ -87,13 +87,13 @@
|
|||||||
with_first_found:
|
with_first_found:
|
||||||
- "{{ node_custom_config }}/keepalived/{{ inventory_hostname }}/keepalived.conf"
|
- "{{ node_custom_config }}/keepalived/{{ inventory_hostname }}/keepalived.conf"
|
||||||
- "{{ node_custom_config }}/keepalived/keepalived.conf"
|
- "{{ node_custom_config }}/keepalived/keepalived.conf"
|
||||||
- "keepalived.conf.j2"
|
- "keepalived/keepalived.conf.j2"
|
||||||
notify:
|
notify:
|
||||||
- Restart keepalived container
|
- Restart keepalived container
|
||||||
|
|
||||||
- name: Copying over haproxy.pem
|
- name: Copying over haproxy.pem
|
||||||
vars:
|
vars:
|
||||||
service: "{{ haproxy_services['haproxy'] }}"
|
service: "{{ loadbalancer_services['haproxy'] }}"
|
||||||
copy:
|
copy:
|
||||||
src: "{{ kolla_external_fqdn_cert }}"
|
src: "{{ kolla_external_fqdn_cert }}"
|
||||||
dest: "{{ node_config_directory }}/haproxy/{{ item }}"
|
dest: "{{ node_config_directory }}/haproxy/{{ item }}"
|
||||||
@ -111,7 +111,7 @@
|
|||||||
|
|
||||||
- name: Copying over haproxy-internal.pem
|
- name: Copying over haproxy-internal.pem
|
||||||
vars:
|
vars:
|
||||||
service: "{{ haproxy_services['haproxy'] }}"
|
service: "{{ loadbalancer_services['haproxy'] }}"
|
||||||
copy:
|
copy:
|
||||||
src: "{{ kolla_internal_fqdn_cert }}"
|
src: "{{ kolla_internal_fqdn_cert }}"
|
||||||
dest: "{{ node_config_directory }}/haproxy/{{ item }}"
|
dest: "{{ node_config_directory }}/haproxy/{{ item }}"
|
||||||
@ -133,7 +133,7 @@
|
|||||||
|
|
||||||
- name: Copying over haproxy start script
|
- name: Copying over haproxy start script
|
||||||
vars:
|
vars:
|
||||||
service: "{{ haproxy_services['haproxy'] }}"
|
service: "{{ loadbalancer_services['haproxy'] }}"
|
||||||
template:
|
template:
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
dest: "{{ node_config_directory }}/haproxy/haproxy_run.sh"
|
dest: "{{ node_config_directory }}/haproxy/haproxy_run.sh"
|
||||||
@ -145,6 +145,6 @@
|
|||||||
with_first_found:
|
with_first_found:
|
||||||
- "{{ node_custom_config }}/haproxy/{{ inventory_hostname }}/haproxy_run.sh"
|
- "{{ node_custom_config }}/haproxy/{{ inventory_hostname }}/haproxy_run.sh"
|
||||||
- "{{ node_custom_config }}/haproxy/haproxy_run.sh"
|
- "{{ node_custom_config }}/haproxy/haproxy_run.sh"
|
||||||
- "haproxy_run.sh.j2"
|
- "haproxy/haproxy_run.sh.j2"
|
||||||
notify:
|
notify:
|
||||||
- Restart haproxy container
|
- Restart haproxy container
|
@ -3,4 +3,4 @@
|
|||||||
import_role:
|
import_role:
|
||||||
role: service-cert-copy
|
role: service-cert-copy
|
||||||
vars:
|
vars:
|
||||||
project_services: "{{ haproxy_services }}"
|
project_services: "{{ loadbalancer_services }}"
|
3
ansible/roles/loadbalancer/tasks/main.yml
Normal file
3
ansible/roles/loadbalancer/tasks/main.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
- include_tasks: "{{ kolla_action }}.yml"
|
||||||
|
when: inventory_hostname in groups['loadbalancer']
|
@ -2,7 +2,7 @@
|
|||||||
- import_role:
|
- import_role:
|
||||||
name: service-precheck
|
name: service-precheck
|
||||||
vars:
|
vars:
|
||||||
service_precheck_services: "{{ haproxy_services }}"
|
service_precheck_services: "{{ loadbalancer_services }}"
|
||||||
service_name: "{{ project_name }}"
|
service_name: "{{ project_name }}"
|
||||||
|
|
||||||
- name: Get container facts
|
- name: Get container facts
|
||||||
@ -19,7 +19,7 @@
|
|||||||
changed_when: false
|
changed_when: false
|
||||||
when:
|
when:
|
||||||
- enable_keepalived | bool
|
- enable_keepalived | bool
|
||||||
- inventory_hostname in groups['haproxy']
|
- inventory_hostname in groups['keepalived']
|
||||||
|
|
||||||
- name: Group hosts by whether they are running HAProxy
|
- name: Group hosts by whether they are running HAProxy
|
||||||
group_by:
|
group_by:
|
||||||
@ -34,7 +34,7 @@
|
|||||||
# NOTE(mgoddard): We can only reliably run this precheck if all hosts in
|
# NOTE(mgoddard): We can only reliably run this precheck if all hosts in
|
||||||
# the haproxy group are included in the batch. This may not be the case if
|
# the haproxy group are included in the batch. This may not be the case if
|
||||||
# using --limit or --serial.
|
# using --limit or --serial.
|
||||||
all_hosts_in_batch: "{{ groups['haproxy'] | difference(ansible_play_batch) | list | length == 0 }}"
|
all_hosts_in_batch: "{{ groups['loadbalancer'] | difference(ansible_play_batch) | list | length == 0 }}"
|
||||||
set_fact:
|
set_fact:
|
||||||
keepalived_vip_prechecks: "{{ all_hosts_in_batch and groups['keepalived_running_True'] is not defined }}"
|
keepalived_vip_prechecks: "{{ all_hosts_in_batch and groups['keepalived_running_True'] is not defined }}"
|
||||||
haproxy_vip_prechecks: "{{ all_hosts_in_batch and groups['haproxy_running_True'] is not defined }}"
|
haproxy_vip_prechecks: "{{ all_hosts_in_batch and groups['haproxy_running_True'] is not defined }}"
|
||||||
@ -156,7 +156,7 @@
|
|||||||
- enable_haproxy | bool
|
- enable_haproxy | bool
|
||||||
- enable_keepalived | bool
|
- enable_keepalived | bool
|
||||||
- container_facts['keepalived'] is not defined
|
- container_facts['keepalived'] is not defined
|
||||||
- inventory_hostname in groups['haproxy']
|
- inventory_hostname in groups['loadbalancer']
|
||||||
|
|
||||||
- name: Getting haproxy stat
|
- name: Getting haproxy stat
|
||||||
shell: echo "show stat" | docker exec -i haproxy socat unix-connect:/var/lib/kolla/haproxy/haproxy.sock stdio # noqa 306
|
shell: echo "show stat" | docker exec -i haproxy socat unix-connect:/var/lib/kolla/haproxy/haproxy.sock stdio # noqa 306
|
@ -2,5 +2,5 @@
|
|||||||
- import_role:
|
- import_role:
|
||||||
name: service-stop
|
name: service-stop
|
||||||
vars:
|
vars:
|
||||||
project_services: "{{ haproxy_services }}"
|
project_services: "{{ loadbalancer_services }}"
|
||||||
service_name: "{{ project_name }}"
|
service_name: "{{ project_name }}"
|
@ -10,13 +10,13 @@ vrrp_instance kolla_internal_vip_{{ keepalived_virtual_router_id }} {
|
|||||||
nopreempt
|
nopreempt
|
||||||
interface {{ api_interface }}
|
interface {{ api_interface }}
|
||||||
virtual_router_id {{ keepalived_virtual_router_id }}
|
virtual_router_id {{ keepalived_virtual_router_id }}
|
||||||
priority {{ groups['haproxy'].index(inventory_hostname) + 1 }}
|
priority {{ groups['loadbalancer'].index(inventory_hostname) + 1 }}
|
||||||
advert_int 1
|
advert_int 1
|
||||||
{% if keepalived_traffic_mode == 'unicast' %}
|
{% if keepalived_traffic_mode == 'unicast' %}
|
||||||
unicast_src_ip {{ api_interface_address }}
|
unicast_src_ip {{ api_interface_address }}
|
||||||
{% if groups['haproxy'] | length > 1 %}
|
{% if groups['loadbalancer'] | length > 1 %}
|
||||||
unicast_peer {
|
unicast_peer {
|
||||||
{% for host in groups['haproxy'] %}
|
{% for host in groups['loadbalancer'] %}
|
||||||
{% set ip_addr = 'api' | kolla_address(host) %}
|
{% set ip_addr = 'api' | kolla_address(host) %}
|
||||||
{% if ip_addr != api_interface_address %}
|
{% if ip_addr != api_interface_address %}
|
||||||
{{ ip_addr }}
|
{{ ip_addr }}
|
@ -8,7 +8,7 @@
|
|||||||
when:
|
when:
|
||||||
- not enable_mariadb | bool
|
- not enable_mariadb | bool
|
||||||
- enable_external_mariadb_load_balancer | bool
|
- enable_external_mariadb_load_balancer | bool
|
||||||
- inventory_hostname in groups['haproxy']
|
- inventory_hostname in groups['loadbalancer']
|
||||||
|
|
||||||
- name: "Check if external database address is reachable from all hosts"
|
- name: "Check if external database address is reachable from all hosts"
|
||||||
wait_for:
|
wait_for:
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
- enable_glance_{{ enable_glance | bool }}
|
- enable_glance_{{ enable_glance | bool }}
|
||||||
- enable_gnocchi_{{ enable_gnocchi | bool }}
|
- enable_gnocchi_{{ enable_gnocchi | bool }}
|
||||||
- enable_grafana_{{ enable_grafana | bool }}
|
- enable_grafana_{{ enable_grafana | bool }}
|
||||||
- enable_haproxy_{{ enable_haproxy | bool }}
|
|
||||||
- enable_hacluster_{{ enable_hacluster | bool }}
|
- enable_hacluster_{{ enable_hacluster | bool }}
|
||||||
- enable_heat_{{ enable_heat | bool }}
|
- enable_heat_{{ enable_heat | bool }}
|
||||||
- enable_horizon_{{ enable_horizon | bool }}
|
- enable_horizon_{{ enable_horizon | bool }}
|
||||||
@ -45,6 +44,7 @@
|
|||||||
- enable_keystone_{{ enable_keystone | bool }}
|
- enable_keystone_{{ enable_keystone | bool }}
|
||||||
- enable_kibana_{{ enable_kibana | bool }}
|
- enable_kibana_{{ enable_kibana | bool }}
|
||||||
- enable_kuryr_{{ enable_kuryr | bool }}
|
- enable_kuryr_{{ enable_kuryr | bool }}
|
||||||
|
- enable_loadbalancer_{{ enable_loadbalancer | bool }}
|
||||||
- enable_magnum_{{ enable_magnum | bool }}
|
- enable_magnum_{{ enable_magnum | bool }}
|
||||||
- enable_manila_{{ enable_manila | bool }}
|
- enable_manila_{{ enable_manila | bool }}
|
||||||
- enable_mariadb_{{ enable_mariadb | bool }}
|
- enable_mariadb_{{ enable_mariadb | bool }}
|
||||||
@ -113,17 +113,17 @@
|
|||||||
tags: chrony,
|
tags: chrony,
|
||||||
when: enable_chrony | bool }
|
when: enable_chrony | bool }
|
||||||
|
|
||||||
- name: Apply role haproxy
|
- name: Apply role loadbalancer
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
hosts:
|
hosts:
|
||||||
- haproxy
|
- loadbalancer
|
||||||
- '&enable_haproxy_True'
|
- '&enable_loadbalancer_True'
|
||||||
serial: '{{ kolla_serial|default("0") }}'
|
serial: '{{ kolla_serial|default("0") }}'
|
||||||
tags:
|
tags:
|
||||||
- haproxy
|
- loadbalancer
|
||||||
roles:
|
roles:
|
||||||
- { role: haproxy,
|
- { role: loadbalancer,
|
||||||
when: enable_haproxy | bool }
|
when: enable_loadbalancer | bool }
|
||||||
tasks:
|
tasks:
|
||||||
- block:
|
- block:
|
||||||
- include_role:
|
- include_role:
|
||||||
|
@ -155,9 +155,15 @@ control
|
|||||||
[hacluster-remote:children]
|
[hacluster-remote:children]
|
||||||
compute
|
compute
|
||||||
|
|
||||||
[haproxy:children]
|
[loadbalancer:children]
|
||||||
network
|
network
|
||||||
|
|
||||||
|
[keepalived:children]
|
||||||
|
loadbalancer
|
||||||
|
|
||||||
|
[haproxy:children]
|
||||||
|
loadbalancer
|
||||||
|
|
||||||
[mariadb:children]
|
[mariadb:children]
|
||||||
control
|
control
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user