Skip to content

Instantly share code, notes, and snippets.

@evrardjp
Last active August 29, 2015 14:27
Show Gist options
  • Save evrardjp/9c7502cf3f9b9a94e66c to your computer and use it in GitHub Desktop.
Save evrardjp/9c7502cf3f9b9a94e66c to your computer and use it in GitHub Desktop.
haproxy ideas
#For a new components that has to be proxied by haproxy, just create the component here and add
newcomponent_hosts:
nameofthehost1:
ip: <ip>
container_vars:
haproxy_service_configs:
- newcomponent_haproxied1:
haproxy_service_name: first_config_file
haproxy_backend_nodes: "{{ [groups['newcomponent_hosts'] }}"
- newcomponent_haproxied2:
haproxy_service_name: second_config_file
haproxy_backend_nodes: "{{ [groups['newcomponent_hosts'] }}"
#We can override the defaults for existing components on a component basis
storage_hosts:
tl10:
ip: 192.168.55.10
container_vars:
cinder_storage_availability_zone: cinder-preprod
cinder_default_availability_zone: cinder-preprod
haproxy_service_configs:
- cinder:
haproxy_service_name: cinder_api
haproxy_backend_nodes: "{{ groups['cinder_api'] }}"
haproxy_port: 8776
...
- name: Install default haproxy with conf.d support
hosts: haproxy_all
role: haproxy_server
tags:
- haproxy-server
# if in user_variables there is a haproxy_custom: True
- include: haproxy-legacy-cleanup
when: haproxy_custom == 'True'
#if its not defined in the inventory, then it won't receive the template -> no unnecessary haproxy backends.
- name: Overwrite openstack services depending on the need
hosts: all
tasks:
- name: Generate config files
delegate_to: haproxy_all
debug: var=item
#will be template on the next version.
with_items: haproxy_service_configs
when: when: haproxy_custom == 'True'
#For existing components, here is where we define the defaults, with each component it's own file.
haproxy_service_configs:
- galera:
haproxy_service_name: galera
haproxy_backend_nodes: "{{ [groups['galera_all'][0]] }}" # list expected
haproxy_backup_nodes: "{{ groups['galera_all'][1:] }}"
haproxy_port: 3306
haproxy_balance_type: tcp
haproxy_timeout_client: 5000s
haproxy_timeout_server: 5000s
haproxy_backend_options:
- "mysql-check user {{ galera_monitoring_user }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment