Use froxlor correctly
This commit is contained in:
parent
bbaf313bc2
commit
64d0d104d3
|
@ -17,4 +17,5 @@ lxc_item_proxy:
|
|||
remove_error_pages: True
|
||||
disable_referer: False
|
||||
letsencrypt: true
|
||||
proxy: "http://[2a01:e0a:21a:17a7::1]:80"
|
||||
upstream: "{{ upstream }}"
|
||||
proxy: "http://froxlor_backend"
|
||||
|
|
|
@ -8,8 +8,58 @@
|
|||
- use_froxlor
|
||||
- not loop_domain in know_froxlor_domain
|
||||
|
||||
- name: "Get domain info"
|
||||
ansible.builtin.uri:
|
||||
url: "{{ froxlor_url }}/api.php"
|
||||
method: "POST"
|
||||
headers:
|
||||
Content-Type: "application/json"
|
||||
Authorization: "Basic {{ froxlor_token }}"
|
||||
body: "{\"command\":\"SubDomains.get\", \"params\": {\"domainname\": \"{{ loop_domain }}\"} }"
|
||||
status_code: 200
|
||||
body_format: "json"
|
||||
register: domain_info
|
||||
delegate_to: localhost
|
||||
when:
|
||||
- use_froxlor is defined
|
||||
- use_froxlor
|
||||
- not loop_domain in know_froxlor_domain
|
||||
tags:
|
||||
- froxlor
|
||||
|
||||
- debug:
|
||||
var: domain_info["json"]["data"]
|
||||
verbosity: 2
|
||||
when:
|
||||
- use_froxlor is defined
|
||||
- use_froxlor
|
||||
- not loop_domain in know_froxlor_domain
|
||||
tags:
|
||||
- froxlor
|
||||
|
||||
- name: show templating results
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ lookup('ansible.builtin.template', 'templates/vhosts/partials/froxlor_upstream.j2') }}"
|
||||
when:
|
||||
- use_froxlor is defined
|
||||
- use_froxlor
|
||||
- not loop_domain in know_froxlor_domain
|
||||
tags:
|
||||
- froxlor
|
||||
|
||||
- name: Set var
|
||||
ansible.builtin.set_fact:
|
||||
upstream: "{{ lookup('ansible.builtin.template', 'templates/vhosts/partials/froxlor_upstream.j2') }}"
|
||||
tags:
|
||||
- froxlor
|
||||
when:
|
||||
- use_froxlor is defined
|
||||
- use_froxlor
|
||||
- not loop_domain in know_froxlor_domain
|
||||
|
||||
- name: Set var
|
||||
ansible.builtin.set_fact:
|
||||
#item: "{{ lxc_item_redirect | combine( { upstream: upstream } ) }}"
|
||||
item: "{{ lxc_item_redirect }}"
|
||||
tags:
|
||||
- froxlor
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
upstream froxlor_backend {
|
||||
{% for ip in domain_info["json"]["data"]["ipsandports"] -%}
|
||||
{%- if ip["ip"] is ansible.utils.ipv6 -%}
|
||||
server [{{ ip["ip"]}}]:{{ ip["port"] }};
|
||||
{%- else -%}
|
||||
server {{ ip["ip"]}}:{{ ip["port"] }};
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
}
|
Loading…
Reference in New Issue