12345678910111213141516171819202122232425262728293031323334353637 |
- - debug:
- var: dom
- - name: Prüfen, wo Variablen nachberechnet werden müssen
- set_fact:
- domaenenliste: "{{domaenenliste | combine( {dom: {'calculation_needed' : 'true'}}, recursive=True)}}"
- when: "(domaenenliste[dom].server_id is not defined) or (domaenenliste[dom].dhcp_start is not defined) or (domaenenliste[dom].dhcp_ende is not defined)"
- - name: Partner setzen
- when: "domaenenliste[dom].calculation_needed is defined and domaenenliste[dom].calculation_needed == 'true'"
- with_items: "{{ groups['supernodes'] }}"
- loop_control:
- loop_var: gates
- include: find_partner.yml supernode={{gates}}
- - name: server_id auf 2 setzen, falls andere vm_id größer
- when: "domaenenliste[dom].calculation_needed is defined and domaenenliste[dom].calculation_needed == 'true' and hostvars[domaenenliste[dom].partner].vm_id > vm_id"
- set_fact:
- domaenenliste: "{{domaenenliste | combine( {dom: {'server_id' : 2}}, recursive=True)}}"
- - name: server_id auf 3 setzen, falls andere vm_id kleiner
- when: "domaenenliste[dom].calculation_needed is defined and domaenenliste[dom].calculation_needed == 'true' and hostvars[domaenenliste[dom].partner].vm_id < vm_id"
- set_fact:
- domaenenliste: "{{domaenenliste | combine( {dom: {'server_id' : 3}}, recursive=True)}}"
- - name: Unterer DHCP-Bereich
- when: "domaenenliste[dom].calculation_needed is defined and domaenenliste[dom].calculation_needed == 'true' and domaenenliste[dom].server_id == 2"
- set_fact:
- domaenenliste: "{{domaenenliste | combine( {dom: {'dhcp_start' : '10.' + dom | int | string + '.64.0', 'dhcp_ende' : '10.' + dom | int | string + '.127.255' }}, recursive=True)}}"
- - name: Oberer DHCP-Bereich
- when: "domaenenliste[dom].calculation_needed is defined and domaenenliste[dom].calculation_needed == 'true' and domaenenliste[dom].server_id == 3"
- set_fact:
- domaenenliste: "{{domaenenliste | combine( {dom: {'dhcp_start' : '10.' + dom | int | string + '.128.0', 'dhcp_ende' : '10.' + dom | int | string + '.191.255' }}, recursive=True)}}"
|