diff --git a/defaults/main.yml b/defaults/main.yml index 89bbfb76..3e2518a9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -269,6 +269,18 @@ octavia_enable_anti_affinity: False # for amphora creation #octavia_amp_availability_zone: +# List of haproxy template files to copy from deployment host to octavia hosts +# octavia_user_haproxy_templates: +# - src: "/etc/openstack_deploy/octavia/haproxy_templates/base.cfg.j2" +# dest: "/etc/octavia/templates/base.cfg.j2" +# - src: "/etc/openstack_deploy/octavia/haproxy_templates/haproxy.cfg.j2" +# dest: "/etc/octavia/templates/haproxy.cfg.j2" +# - src: "/etc/openstack_deploy/octavia/haproxy_templates/macros.cfg.j2" +# dest: "/etc/octavia/templates/macros.cfg.j2" +octavia_user_haproxy_templates: {} +# Path of custom haproxy template file +#octavia_haproxy_amphora_template: /etc/octavia/templates/haproxy.cfg.j2 + # Name of the Octavia management network in Neutron octavia_neutron_management_network_name: lbaas-mgmt # Name of the provider net in the system @@ -350,4 +362,4 @@ octavia_network_driver: allowed_address_pairs_driver ## Tunable overrides octavia_octavia_conf_overrides: {} octavia_api_paste_ini_overrides: {} -octavia_policy_overrides: {} \ No newline at end of file +octavia_policy_overrides: {} diff --git a/releasenotes/notes/os-octavia-haproxy-templates-18561d31bcd7151e.yaml b/releasenotes/notes/os-octavia-haproxy-templates-18561d31bcd7151e.yaml new file mode 100644 index 00000000..5e50e1ad --- /dev/null +++ b/releasenotes/notes/os-octavia-haproxy-templates-18561d31bcd7151e.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Deployers may provide a list of custom haproxy template files to copy from + the deployment host through the ``octavia_user_haproxy_templates`` variable + and configure Octavia to make use of a custom haproxy template file with + with ``octavia_haproxy_amphora_template`` variable. diff --git a/tasks/octavia_post_install.yml b/tasks/octavia_post_install.yml index 35aa29a9..a8190601 100644 --- a/tasks/octavia_post_install.yml +++ b/tasks/octavia_post_install.yml @@ -56,6 +56,15 @@ - src: "{{ octavia_ca_private_key }}" dest: "/etc/octavia/certs/ca_key.pem" +- name: Copy user provided HAProxy templates + copy: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ octavia_system_user_name }}" + group: "{{ octavia_system_group_name }}" + mode: "0640" + with_items: "{{ octavia_user_haproxy_templates }}" + - name: Drop octavia Config(s) config_template: src: "{{ item.src }}" @@ -79,4 +88,4 @@ # config_overrides: "{{ octavia_policy_overrides }}" # config_type: "json" notify: - - Restart octavia services \ No newline at end of file + - Restart octavia services diff --git a/templates/octavia.conf.j2 b/templates/octavia.conf.j2 index c4991188..197078f4 100644 --- a/templates/octavia.conf.j2 +++ b/templates/octavia.conf.j2 @@ -120,7 +120,9 @@ lb_network_name = {{ octavia_neutron_management_network_uuid }} # base_path = /var/lib/octavia # base_cert_dir = /var/lib/octavia/certs # Absolute path to a custom HAProxy template file -# haproxy_template = +{% if octavia_haproxy_amphora_template is defined %} +haproxy_template = {{ octavia_haproxy_amphora_template }} +{% endif %} # connection_max_retries = 300 # connection_retry_interval = 5