init_vars.yml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. ---
  2. - name: preflight - {{item}} - Define ip_host
  3. shell:
  4. cmd: echo "$(../roles/stable/build/files/mac56-to-ip_host.sh {{ item }} --start-from 128)"
  5. register: ip_host
  6. delegate_to: localhost
  7. - name: preflight - {{item}} - Save ip_host
  8. blockinfile:
  9. path: ../host_vars/{{ item }}.yml
  10. block: "ip_host: {{ ip_host.stdout }}"
  11. marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item }} utils"
  12. create: yes
  13. delegate_to: localhost
  14. - name: preflight - {{item}} - Init host_vars common
  15. blockinfile:
  16. path: ../host_vars/{{ item }}.yml
  17. block: |
  18. hostname: {{ hostvars[item].hostname }}
  19. lime_mac: {{ item }}
  20. main_ipv4_address: {{ ip_network }}.{{ ip_host.stdout }}{{ ip_netmask }}
  21. marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item }} common"
  22. create: yes
  23. delegate_to: localhost
  24. - name: preflight - {{item}} - Init host_vars config
  25. blockinfile:
  26. path: ../host_vars/{{ item }}.yml
  27. block: |
  28. config_lime_system: option hostname '{{ hostvars[item].hostname }}'
  29. config_lime_wifi: option channel_5ghz '{% if hostvars[item].channel_5ghz is defined %}{{ hostvars[item].channel_5ghz }}{% else %}{{ default_channel_5ghz }}{% endif %}'
  30. marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item }} config"
  31. create: yes
  32. delegate_to: localhost