refactor(configuration): centralize DNS list variables in network dispatch
This commit is contained in:
@@ -29,5 +29,10 @@
|
|||||||
- configuration_detected_interfaces | length > 0
|
- configuration_detected_interfaces | length > 0
|
||||||
fail_msg: Failed to detect any network interfaces.
|
fail_msg: Failed to detect any network interfaces.
|
||||||
|
|
||||||
|
- name: Set DNS configuration facts
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
configuration_dns_list: "{{ system_cfg.network.dns.servers }}"
|
||||||
|
configuration_dns_search: "{{ system_cfg.network.dns.search }}"
|
||||||
|
|
||||||
- name: Configure networking
|
- name: Configure networking
|
||||||
ansible.builtin.include_tasks: "{{ configuration_network_task_map[os] | default('network_nm.yml') }}"
|
ansible.builtin.include_tasks: "{{ configuration_network_task_map[os] | default('network_nm.yml') }}"
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: Write Alpine network interfaces
|
- name: Write Alpine network interfaces
|
||||||
vars:
|
|
||||||
configuration_dns_list: "{{ system_cfg.network.dns.servers | default([]) }}"
|
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: /mnt/etc/network/interfaces
|
dest: /mnt/etc/network/interfaces
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
@@ -25,9 +23,6 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
- name: Set Alpine DNS resolvers
|
- name: Set Alpine DNS resolvers
|
||||||
vars:
|
|
||||||
configuration_dns_list: "{{ system_cfg.network.dns.servers | default([]) }}"
|
|
||||||
configuration_dns_search: "{{ system_cfg.network.dns.search | default([]) }}"
|
|
||||||
when: configuration_dns_list | length > 0 or configuration_dns_search | length > 0
|
when: configuration_dns_list | length > 0 or configuration_dns_search | length > 0
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: /mnt/etc/resolv.conf
|
dest: /mnt/etc/resolv.conf
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: Write dhcpcd configuration
|
- name: Write dhcpcd configuration
|
||||||
vars:
|
|
||||||
configuration_dns_list: "{{ system_cfg.network.dns.servers | default([]) }}"
|
|
||||||
configuration_dns_search: "{{ system_cfg.network.dns.search | default([]) }}"
|
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: /mnt/etc/dhcpcd.conf
|
dest: /mnt/etc/dhcpcd.conf
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ interface-name={{ configuration_iface_name }}
|
|||||||
|
|
||||||
[ipv4]
|
[ipv4]
|
||||||
{% set iface = configuration_iface %}
|
{% set iface = configuration_iface %}
|
||||||
{% set dns_list = system_cfg.network.dns.servers | default([]) %}
|
{% set dns_list = configuration_dns_list %}
|
||||||
{% set search_list = system_cfg.network.dns.search | default([]) %}
|
{% set search_list = configuration_dns_search %}
|
||||||
{% if iface.ip | default('') | string | length %}
|
{% if iface.ip | default('') | string | length %}
|
||||||
address1={{ iface.ip }}/{{ iface.prefix }}{{ (',' ~ iface.gateway) if (iface.gateway | default('') | string | length) else '' }}
|
address1={{ iface.ip }}/{{ iface.prefix }}{{ (',' ~ iface.gateway) if (iface.gateway | default('') | string | length) else '' }}
|
||||||
method=manual
|
method=manual
|
||||||
|
|||||||
Reference in New Issue
Block a user