diff options
| author | Michal Jastrzebski (inc0) <michal.jastrzebski@intel.com> | 2015-07-17 12:20:31 +0200 |
|---|---|---|
| committer | Sam Yaple <sam@yaple.net> | 2015-07-28 15:46:42 +0000 |
| commit | 2d920745a45eec166e2c381aa7b15b1168b03887 (patch) | |
| tree | 71612a929fe71a0fffc1261e89acfd408457b321 /ansible | |
| parent | 4d6eaa25fc881dec699e5b0a4a4f196881338b2c (diff) | |
| download | kolla-2d920745a45eec166e2c381aa7b15b1168b03887.tar.gz kolla-2d920745a45eec166e2c381aa7b15b1168b03887.zip | |
Ansible install of HAProxy
This commit consists HAProxy ansible bits including config generation,
container deployment and hot reloads.
Closes-Bug: #1477915
Co-Authored-By: Sam Yaple <sam@yaple.net>
Change-Id: Ie93fa68fdb6b2885889c992ff1267d38b68e0cbc
Partially-implements: blueprint ansible-service
Diffstat (limited to 'ansible')
| -rw-r--r-- | ansible/inventory/all-in-one | 3 | ||||
| -rw-r--r-- | ansible/inventory/multinode | 3 | ||||
| -rwxr-xr-x | ansible/roles/haproxy/defaults/main.yml | 16 | ||||
| -rwxr-xr-x | ansible/roles/haproxy/tasks/config.yml | 14 | ||||
| -rwxr-xr-x | ansible/roles/haproxy/tasks/main.yml | 4 | ||||
| -rwxr-xr-x | ansible/roles/haproxy/tasks/start.yml | 14 | ||||
| -rwxr-xr-x | ansible/roles/haproxy/templates/haproxy.cfg.j2 | 73 | ||||
| -rwxr-xr-x[-rw-r--r--] | ansible/site.yml | 8 |
8 files changed, 134 insertions, 1 deletions
diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index 7fd25f9d6..c79d87eb9 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -12,6 +12,9 @@ localhost ansible_connection=local # You can explicitly specify which hosts run each project by updating the # groups in the sections below. Common services are grouped together. +[haproxy:children] +support + [database:children] support diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode index 5df5a783f..116f813ff 100644 --- a/ansible/inventory/multinode +++ b/ansible/inventory/multinode @@ -15,6 +15,9 @@ compute01 # You can explicitly specify which hosts run each project by updating the # groups in the sections below. Common services are grouped together. +[haproxy:children] +support + [database:children] support diff --git a/ansible/roles/haproxy/defaults/main.yml b/ansible/roles/haproxy/defaults/main.yml new file mode 100755 index 000000000..1d8b444a6 --- /dev/null +++ b/ansible/roles/haproxy/defaults/main.yml @@ -0,0 +1,16 @@ +--- +project_name: "haproxy" + + +#################### +# Docker +#################### +docker_haproxy_registry: "{{ docker_registry }}" +docker_haproxy_namespace: "{{ docker_namespace }}" +kolla_haproxy_base_distro: "{{ kolla_base_distro }}" +kolla_haproxy_install_type: "{{ kolla_install_type }}" +kolla_haproxy_container_name: "haproxy" + +docker_haproxy_image: "{{ docker_haproxy_registry }}{{ docker_haproxy_namespace }}/{{ kolla_haproxy_base_distro }}-{{ kolla_haproxy_install_type }}-{{ kolla_haproxy_container_name }}" +docker_haproxy_tag: "{{ openstack_release }}" +docker_haproxy_image_full: "{{ docker_haproxy_image }}:{{ docker_haproxy_tag }}" diff --git a/ansible/roles/haproxy/tasks/config.yml b/ansible/roles/haproxy/tasks/config.yml new file mode 100755 index 000000000..6aa4c0bba --- /dev/null +++ b/ansible/roles/haproxy/tasks/config.yml @@ -0,0 +1,14 @@ +--- +- name: Ensuring config directory exists + file: + path: "{{ node_config_directory }}/haproxy/" + state: "directory" + recurse: "yes" + +- name: Copying over config(s) + template: + src: "haproxy.cfg.j2" + dest: "{{ node_config_directory }}/haproxy/haproxy.cfg" + +- name: Allowing non-local IP binding + sysctl: name="net.ipv4.ip_nonlocal_bind" value=1 sysctl_set=yes diff --git a/ansible/roles/haproxy/tasks/main.yml b/ansible/roles/haproxy/tasks/main.yml new file mode 100755 index 000000000..1f16915ad --- /dev/null +++ b/ansible/roles/haproxy/tasks/main.yml @@ -0,0 +1,4 @@ +--- +- include: config.yml + +- include: start.yml diff --git a/ansible/roles/haproxy/tasks/start.yml b/ansible/roles/haproxy/tasks/start.yml new file mode 100755 index 000000000..cbb577b0f --- /dev/null +++ b/ansible/roles/haproxy/tasks/start.yml @@ -0,0 +1,14 @@ +--- +- include: ../../start.yml + vars: + container_image: "{{ docker_haproxy_image_full }}" + container_name: "haproxy" + container_volumes: + - "{{ node_config_directory }}/haproxy/:/opt/kolla/haproxy/:ro" + container_environment: + KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + +- name: Ensuring latest haproxy config is used + command: docker exec haproxy /opt/kolla/ensure_latest_config.sh + register: status + changed_when: status.stdout.find('changed') != -1 diff --git a/ansible/roles/haproxy/templates/haproxy.cfg.j2 b/ansible/roles/haproxy/templates/haproxy.cfg.j2 new file mode 100755 index 000000000..07fe7aacf --- /dev/null +++ b/ansible/roles/haproxy/templates/haproxy.cfg.j2 @@ -0,0 +1,73 @@ +global + daemon + maxconn 4000 + +defaults + mode http + maxconn 4000 + option redispatch + retries 3 + timeout http-request 10s + timeout queue 1m + timeout connect 10s + timeout client 1m + timeout server 1m + timeout check 10s + +listen mariadb + mode tcp + option mysql-check user haproxy + option tcpka + + # TODO(SamYaple): Make DB port configurable throughout Ansible + bind {{ kolla_internal_address }}:3306 +{% for host in groups['database'] %} + server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:3306 check inter 2000 rise 2 fall 5 {% if not loop.first %}backup{% endif %} + +{% endfor %} + +listen rabbitmq + mode tcp + option tcpka + + # TODO(SamYaple): Make rabbitmq port configurable throughout Ansible + bind {{ kolla_internal_address }}:5672 +{% for host in groups['message-broker'] %} + server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:5672 check inter 2000 rise 2 fall 5 +{% endfor %} + +listen keystone_public + bind {{ kolla_internal_address }}:{{ keystone_public_port }} +{% for host in groups['keystone'] %} + server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:{{ keystone_public_port }} check inter 2000 rise 2 fall 5 +{% endfor %} + +listen keystone_admin + bind {{ kolla_internal_address }}:{{ keystone_admin_port }} +{% for host in groups['keystone'] %} + server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:{{ keystone_admin_port }} check inter 2000 rise 2 fall 5 +{% endfor %} + +listen glance_registry + bind {{ kolla_internal_address }}:{{ glance_registry_port }} +{% for host in groups['glance'] %} + server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:{{ glance_registry_port }} check inter 2000 rise 2 fall 5 +{% endfor %} + +listen glance_api + bind {{ kolla_internal_address }}:{{ glance_api_port }} +{% for host in groups['glance'] %} + server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:{{ glance_api_port }} check inter 2000 rise 2 fall 5 +{% endfor %} + +listen nova_api + bind {{ kolla_internal_address }}:{{ nova_api_port }} +{% for host in groups['nova-api'] %} + server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:{{ nova_api_port }} check inter 2000 rise 2 fall 5 +{% endfor %} + +listen neutron_server + bind {{ kolla_internal_address }}:{{ neutron_server_port }} +{% for host in groups['neutron-server'] %} + server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:{{ neutron_server_port }} check inter 2000 rise 2 fall 5 +{% endfor %} diff --git a/ansible/site.yml b/ansible/site.yml index 5abb1d07d..1b708080b 100644..100755 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -1,8 +1,14 @@ --- +- hosts: haproxy + roles: + - haproxy + tags: haproxy + - hosts: database roles: - database - tags: database + tags: + - database - hosts: message-broker roles: |
