Fixed haproxy resource
This commit is contained in:
parent
68e3298d5c
commit
8426c0656b
@ -2,21 +2,21 @@
|
|||||||
- hosts: [{{host}}]
|
- hosts: [{{host}}]
|
||||||
sudo: yes
|
sudo: yes
|
||||||
vars:
|
vars:
|
||||||
config_dir: {src: {{ config_dir.value['src'] }}, dst: {{ config_dir.value['dst'] }}}
|
config_dir: {src: {{ config_dir['src'] }}, dst: {{ config_dir['dst'] }}}
|
||||||
haproxy_ip: {{ ip }}
|
haproxy_ip: {{ ip }}
|
||||||
haproxy_services:
|
haproxy_services:
|
||||||
{% for service, ports, listen_port, protocol in zip(configs.value, configs_ports.value, listen_ports.value, configs_protocols.value) %}
|
{% for single in config %}
|
||||||
- name: {{ service['emitter_attached_to'] }}
|
- name: {{ single['name'] }}
|
||||||
listen_port: {{ listen_port['value'] }}
|
listen_port: {{ single['listen_port'] }}
|
||||||
protocol: {{ protocol['value'] }}
|
protocol: {{ single['protocol'] }}
|
||||||
servers:
|
servers:
|
||||||
{% for server_ip, server_port in zip(service['value'], ports['value']) %}
|
{% for backend in single['backends'] %}
|
||||||
- name: {{ server_ip['emitter_attached_to'] }}
|
- name: {{ backend['server'] }}_{{ backend['port'] }}
|
||||||
ip: {{ server_ip['value'] }}
|
ip: {{ backend['server'] }}
|
||||||
port: {{ server_port['value'] }}
|
port: {{ backend['port'] }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
tasks:
|
tasks:
|
||||||
- file: path={{ config_dir.value['src'] }}/ state=directory
|
- file: path={{ config_dir['src'] }}/ state=directory
|
||||||
- file: path={{ config_dir.value['src'] }}/haproxy.cfg state=touch
|
- file: path={{ config_dir['src'] }}/haproxy.cfg state=touch
|
||||||
- template: src={{templates_dir}}/haproxy.cfg dest=/etc/haproxy/haproxy.cfg
|
- template: src={{templates_dir}}/haproxy.cfg dest=/etc/haproxy/haproxy.cfg
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
# TODO
|
# TODO
|
||||||
- hosts: [{{ip}}]
|
- hosts: [{{host}}]
|
||||||
sudo: yes
|
sudo: yes
|
||||||
vars:
|
vars:
|
||||||
config_dir: {src: {{ config_dir.value['src'] }}, dst: {{ config_dir.value['dst'] }}}
|
config_dir: {src: {{ config_dir['src'] }}, dst: {{ config_dir['dst'] }}}
|
||||||
haproxy_ip: {{ ip }}
|
haproxy_ip: {{ ip }}
|
||||||
haproxy_services:
|
haproxy_services:
|
||||||
{% for service, ports, listen_port, protocol in zip(configs.value, configs_ports.value, listen_ports.value, configs_protocols.value) %}
|
{% for single in config %}
|
||||||
- name: {{ service['emitter_attached_to'] }}
|
- name: {{ single['name'] }}
|
||||||
listen_port: {{ listen_port['value'] }}
|
listen_port: {{ single['listen_port'] }}
|
||||||
protocol: {{ protocol['value'] }}
|
protocol: {{ single['protocol'] }}
|
||||||
servers:
|
servers:
|
||||||
{% for server_ip, server_port in zip(service['value'], ports['value']) %}
|
{% for backend in single['backends'] %}
|
||||||
- name: {{ server_ip['emitter_attached_to'] }}
|
- name: {{ backend['server'] }}_{{ backend['port'] }}
|
||||||
ip: {{ server_ip['value'] }}
|
ip: {{ backend['server'] }}
|
||||||
port: {{ server_port['value'] }}
|
port: {{ backend['port'] }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
tasks:
|
tasks:
|
||||||
- file: path={{ config_dir.value['src'] }}/ state=directory
|
- file: path={{ config_dir['src'] }}/ state=directory
|
||||||
- file: path={{ config_dir.value['src'] }}/haproxy.cfg state=touch
|
- file: path={{ config_dir['src'] }}/haproxy.cfg state=touch
|
||||||
- template: src={{templates_dir}}/haproxy.cfg dest=/etc/haproxy/haproxy.cfg
|
- template: src={{templates_dir}}/haproxy.cfg dest=/etc/haproxy/haproxy.cfg
|
||||||
|
@ -8,21 +8,6 @@ input:
|
|||||||
config_dir:
|
config_dir:
|
||||||
schema: {src: str!, dst: str!}
|
schema: {src: str!, dst: str!}
|
||||||
value: {src: /etc/solar/haproxy, dst: /etc/haproxy}
|
value: {src: /etc/solar/haproxy, dst: /etc/haproxy}
|
||||||
# listen_ports:
|
|
||||||
# schema: [int]
|
|
||||||
# value: []
|
|
||||||
# configs:
|
|
||||||
# schema: [[str]]
|
|
||||||
# value: []
|
|
||||||
# configs_names:
|
|
||||||
# schema: [str]
|
|
||||||
# value: []
|
|
||||||
# configs_ports:
|
|
||||||
# schema: [[int]]
|
|
||||||
# value: []
|
|
||||||
# configs_protocols:
|
|
||||||
# schema: [str]
|
|
||||||
# value: []
|
|
||||||
config:
|
config:
|
||||||
schema: [{backends: [{server: str!, port: int!}], listen_port: int!, protocol: str!, name: str!}]
|
schema: [{backends: [{server: str!, port: int!}], listen_port: int!, protocol: str!, name: str!}]
|
||||||
value: []
|
value: []
|
||||||
|
Loading…
Reference in New Issue
Block a user