mirror of
https://gitea.0xace.cc/ansible-galaxy/haproxy.git
synced 2024-11-24 16:06:40 +00:00
fix config override check
This commit is contained in:
parent
d6457d12da
commit
42ecb387b6
@ -60,10 +60,13 @@
|
||||
when: sysctl_result.changed
|
||||
|
||||
- name: Apply default config
|
||||
when:
|
||||
- haproxy_config_override is not defined or haproxy_config_override | length <= 0
|
||||
- haproxy_config_base64_override is not defined or haproxy_config_base64_override | length <= 0
|
||||
block:
|
||||
- name: Merge config for HAProxy
|
||||
set_fact:
|
||||
haproxy_combined_config: "{{ haproxy_config | default({}) | combine(haproxy_default_config, recursive=true) }}"
|
||||
haproxy_combined_config: "{{ haproxy_default_config | combine(haproxy_config | default({}), recursive=true) }}"
|
||||
|
||||
- name: Add HAProxy config
|
||||
template:
|
||||
@ -71,11 +74,11 @@
|
||||
dest: "/etc/haproxy/haproxy.cfg"
|
||||
notify:
|
||||
- Reload HAProxy
|
||||
when:
|
||||
- haproxy_config_override is not defined
|
||||
- haproxy_config_base64_override is not defined
|
||||
|
||||
- name: Override with config in plain text
|
||||
when:
|
||||
- haproxy_config_override is defined
|
||||
- haproxy_config_override | length > 0
|
||||
block:
|
||||
- set_fact:
|
||||
haproxy_config: "{{ haproxy_config_override }}"
|
||||
@ -86,9 +89,11 @@
|
||||
dest: "/etc/haproxy/haproxy.cfg"
|
||||
notify:
|
||||
- Reload HAProxy
|
||||
when: haproxy_config_override is defined
|
||||
|
||||
- name: Override with base64 config
|
||||
when:
|
||||
- haproxy_config_base64_override is defined
|
||||
- haproxy_config_base64_override | length > 0
|
||||
block:
|
||||
- set_fact:
|
||||
haproxy_config: "{{ haproxy_config_base64_override | b64decode }}"
|
||||
@ -99,7 +104,6 @@
|
||||
dest: "/etc/haproxy/haproxy.cfg"
|
||||
notify:
|
||||
- Reload HAProxy
|
||||
when: haproxy_config_base64_override is defined
|
||||
|
||||
- name: Add maps for HAProxy
|
||||
include_tasks: map.yaml
|
||||
|
@ -68,10 +68,13 @@
|
||||
when: sysctl_result.changed
|
||||
|
||||
- name: Apply default config
|
||||
when:
|
||||
- haproxy_config_override is not defined or haproxy_config_override | length <= 0
|
||||
- haproxy_config_base64_override is not defined or haproxy_config_base64_override | length <= 0
|
||||
block:
|
||||
- name: Merge config for HAProxy
|
||||
set_fact:
|
||||
haproxy_combined_config: "{{ haproxy_config | default({}) | combine(haproxy_default_config, recursive=true) }}"
|
||||
haproxy_combined_config: "{{ haproxy_default_config | combine(haproxy_config | default({}), recursive=true) }}"
|
||||
|
||||
- name: Add HAProxy config
|
||||
template:
|
||||
@ -79,11 +82,11 @@
|
||||
dest: "/etc/haproxy/haproxy.cfg"
|
||||
notify:
|
||||
- Reload HAProxy
|
||||
when:
|
||||
- haproxy_config_override is not defined
|
||||
- haproxy_config_base64_override is not defined
|
||||
|
||||
- name: Override with config in plain text
|
||||
when:
|
||||
- haproxy_config_override is defined
|
||||
- haproxy_config_override | length > 0
|
||||
block:
|
||||
- set_fact:
|
||||
haproxy_config: "{{ haproxy_config_override }}"
|
||||
@ -94,9 +97,11 @@
|
||||
dest: "/etc/haproxy/haproxy.cfg"
|
||||
notify:
|
||||
- Reload HAProxy
|
||||
when: haproxy_config_override is defined
|
||||
|
||||
- name: Override with base64 config
|
||||
when:
|
||||
- haproxy_config_base64_override is defined
|
||||
- haproxy_config_base64_override | length > 0
|
||||
block:
|
||||
- set_fact:
|
||||
haproxy_config: "{{ haproxy_config_base64_override | b64decode }}"
|
||||
@ -107,7 +112,6 @@
|
||||
dest: "/etc/haproxy/haproxy.cfg"
|
||||
notify:
|
||||
- Reload HAProxy
|
||||
when: haproxy_config_base64_override is defined
|
||||
|
||||
- name: Add maps for HAProxy
|
||||
include_tasks: map.yaml
|
||||
|
Loading…
Reference in New Issue
Block a user