infra_public/roles/stable/build/tasks/init_vars.yml

35 lines
1.3 KiB
YAML

---
- name: preflight - {{item}} - Define ip_host
shell:
cmd: echo "$(../roles/stable/build/files/mac56-to-ip_host.sh {{ item }} --start-from 128)"
register: ip_host
delegate_to: localhost
- name: preflight - {{item}} - Save ip_host
blockinfile:
path: ../host_vars/{{ item }}.yml
block: "ip_host: {{ ip_host.stdout }}"
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item }} utils"
create: yes
delegate_to: localhost
- name: preflight - {{item}} - Init host_vars common
blockinfile:
path: ../host_vars/{{ item }}.yml
block: |
hostname: {{ hostvars[item].hostname }}
lime_mac: {{ item }}
main_ipv4_address: {{ ip_network }}.{{ ip_host.stdout }}{{ ip_netmask }}
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item }} common"
create: yes
delegate_to: localhost
- name: preflight - {{item}} - Init host_vars config
blockinfile:
path: ../host_vars/{{ item }}.yml
block: |
config_lime_system: option hostname '{{ hostvars[item].hostname }}'
config_lime_wifi: option channel_5ghz '{% if hostvars[item].channel_5ghz is defined %}{{ hostvars[item].channel_5ghz }}{% else %}{{ default_channel_5ghz }}{% endif %}'
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item }} config"
create: yes
delegate_to: localhost