Modify the haproxy play for ansible2 compat

The haproxy play fails when being executed under ansible 2.x
The failure is caused by the task include which reaches into
the hapeoxy role to rerun a template action when a conditional
is met. To make this play ansible 2.x compatible the include was
removed and the role was simply called a second time with a
provided set of variables which will accomplish the same thing.
Without this change the services.j2 template would require a
symlink in the playbook directory in order to allow ansible 2.x
to access the file.

Change-Id: I9cb93b2bcb7f1a4140a73e6e4cae38803b894a2c
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2016-03-31 00:38:43 -05:00 committed by Kevin Carter (cloudnull)
parent 17a64895a3
commit f56c9c6019

View File

@ -102,25 +102,6 @@
when: is_metal | bool
tags:
- haproxy-logs
post_tasks:
- name: Add keystone internal endpoint config
include: roles/haproxy_server/tasks/haproxy_service_config.yml
when: internal_lb_vip_address != external_lb_vip_address
vars_files:
- vars/configs/haproxy_config.yml
vars:
haproxy_service_configs:
- service:
haproxy_service_name: keystone_internal
haproxy_backend_nodes: "{{ groups['keystone_all'] }}"
haproxy_bind: "{{ internal_lb_vip_address }}"
haproxy_port: 5000
haproxy_ssl: "{% if haproxy_ssl | bool and keystone_service_internaluri_proto == 'https' %}true{% else %}false{% endif %}"
haproxy_balance_type: "{{ (keystone_ssl_internal | bool) | ternary('tcp','http') }}"
haproxy_balance_alg: "{{ (keystone_ssl_internal | bool) | ternary('source', 'leastconn') }}"
haproxy_backend_options: "{{ (keystone_ssl_internal | bool) | ternary(haproxy_backend_options_https, haproxy_backend_options_http) }}"
tags:
- haproxy-service-config
- name: Remove legacy haproxy logging file
file:
dest: "/etc/rsyslog.d/haproxy.conf"
@ -129,6 +110,19 @@
- haproxy-service-config
roles:
- { role: "haproxy_server", tags: [ "haproxy-server" ] }
- role: haproxy_server
haproxy_service_configs:
- service:
haproxy_service_name: keystone_internal
haproxy_backend_nodes: "{{ groups['keystone_all'] }}"
haproxy_bind: "{{ internal_lb_vip_address }}"
haproxy_port: 5000
haproxy_ssl: "{% if haproxy_ssl | bool and keystone_service_internaluri_proto == 'https' %}true{% else %}false{% endif %}"
haproxy_balance_type: "{{ (keystone_ssl_internal | bool) | ternary('tcp','http') }}"
haproxy_balance_alg: "{{ (keystone_ssl_internal | bool) | ternary('source', 'leastconn') }}"
haproxy_backend_options: "{{ (keystone_ssl_internal | bool) | ternary(haproxy_backend_options_https, haproxy_backend_options_http) }}"
when: internal_lb_vip_address != external_lb_vip_address
- role: "rsyslog_client"
rsyslog_client_log_rotate_file: haproxy_log_rotate
rsyslog_client_log_dir: "/var/log/haproxy"
@ -140,3 +134,4 @@
- vars/configs/haproxy_config.yml
vars:
is_metal: "{{ properties.is_metal|default(false) }}"