refactor(bootstrap): nest network fields under system.network to match main project schema
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
|
||||
- name: Set hostname
|
||||
vars:
|
||||
configuration_dns_domain: "{{ (system_cfg.dns.search | default([]) | first | default('')) | string }}"
|
||||
configuration_dns_domain: "{{ (system_cfg.network.dns.search | default([]) | first | default('')) | string }}"
|
||||
configuration_hostname_fqdn: >-
|
||||
{{
|
||||
hostname
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
- name: Add host entry to /etc/hosts
|
||||
vars:
|
||||
configuration_dns_domain: "{{ (system_cfg.dns.search | default([]) | first | default('')) | string }}"
|
||||
configuration_dns_domain: "{{ (system_cfg.network.dns.search | default([]) | first | default('')) | string }}"
|
||||
configuration_hostname_fqdn: >-
|
||||
{{
|
||||
hostname
|
||||
@@ -65,8 +65,8 @@
|
||||
{{ [configuration_hostname_fqdn, configuration_hostname_short] | unique | join(' ') }}
|
||||
configuration_hosts_ip: >-
|
||||
{{
|
||||
system_cfg.ip
|
||||
if system_cfg.ip is defined and (system_cfg.ip | string | length) > 0
|
||||
system_cfg.network.ip
|
||||
if system_cfg.network.ip is defined and (system_cfg.network.ip | string | length) > 0
|
||||
else inventory_hostname
|
||||
}}
|
||||
configuration_hosts_line: >-
|
||||
|
||||
@@ -101,13 +101,13 @@
|
||||
- name: Configure Alpine networking
|
||||
when: os | lower == "alpine"
|
||||
vars:
|
||||
configuration_dns_list: "{{ system_cfg.dns.servers | default([]) }}"
|
||||
configuration_dns_list: "{{ system_cfg.network.dns.servers | default([]) }}"
|
||||
configuration_alpine_static: >-
|
||||
{{
|
||||
system_cfg.ip is defined
|
||||
and system_cfg.ip | string | length > 0
|
||||
and system_cfg.prefix is defined
|
||||
and (system_cfg.prefix | string | length) > 0
|
||||
system_cfg.network.ip is defined
|
||||
and system_cfg.network.ip | string | length > 0
|
||||
and system_cfg.network.prefix is defined
|
||||
and (system_cfg.network.prefix | string | length) > 0
|
||||
}}
|
||||
block:
|
||||
- name: Write Alpine network interfaces
|
||||
@@ -121,9 +121,9 @@
|
||||
auto {{ configuration_net_inf }}
|
||||
iface {{ configuration_net_inf }} inet {{ 'static' if configuration_alpine_static | bool else 'dhcp' }}
|
||||
{% if configuration_alpine_static | bool %}
|
||||
address {{ system_cfg.ip }}/{{ system_cfg.prefix }}
|
||||
{% if system_cfg.gateway is defined and system_cfg.gateway | string | length %}
|
||||
gateway {{ system_cfg.gateway }}
|
||||
address {{ system_cfg.network.ip }}/{{ system_cfg.network.prefix }}
|
||||
{% if system_cfg.network.gateway is defined and system_cfg.network.gateway | string | length %}
|
||||
gateway {{ system_cfg.network.gateway }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -140,13 +140,13 @@
|
||||
- name: Configure Void networking
|
||||
when: os | lower == "void"
|
||||
vars:
|
||||
configuration_dns_list: "{{ system_cfg.dns.servers | default([]) }}"
|
||||
configuration_dns_list: "{{ system_cfg.network.dns.servers | default([]) }}"
|
||||
configuration_void_static: >-
|
||||
{{
|
||||
system_cfg.ip is defined
|
||||
and system_cfg.ip | string | length > 0
|
||||
and system_cfg.prefix is defined
|
||||
and (system_cfg.prefix | string | length) > 0
|
||||
system_cfg.network.ip is defined
|
||||
and system_cfg.network.ip | string | length > 0
|
||||
and system_cfg.network.prefix is defined
|
||||
and (system_cfg.network.prefix | string | length) > 0
|
||||
}}
|
||||
block:
|
||||
- name: Write dhcpcd configuration for static networking
|
||||
@@ -156,9 +156,9 @@
|
||||
mode: "0644"
|
||||
content: |
|
||||
interface {{ configuration_net_inf }}
|
||||
static ip_address={{ system_cfg.ip }}/{{ system_cfg.prefix }}
|
||||
{% if system_cfg.gateway is defined and system_cfg.gateway | string | length %}
|
||||
static routers={{ system_cfg.gateway }}
|
||||
static ip_address={{ system_cfg.network.ip }}/{{ system_cfg.network.prefix }}
|
||||
{% if system_cfg.network.gateway is defined and system_cfg.network.gateway | string | length %}
|
||||
static routers={{ system_cfg.network.gateway }}
|
||||
{% endif %}
|
||||
{% if configuration_dns_list | length > 0 %}
|
||||
static domain_name_servers={{ configuration_dns_list | join(' ') }}
|
||||
|
||||
@@ -4,10 +4,10 @@ uuid={{ configuration_net_uuid }}
|
||||
type=ethernet
|
||||
|
||||
[ipv4]
|
||||
{% set dns_list = system_cfg.dns.servers | default([]) %}
|
||||
{% set search_list = system_cfg.dns.search | default([]) %}
|
||||
{% if system_cfg.ip is defined and system_cfg.ip | string | length %}
|
||||
address1={{ system_cfg.ip }}/{{ system_cfg.prefix }}{{ (',' ~ system_cfg.gateway) if (system_cfg.gateway is defined and system_cfg.gateway | string | length) else '' }}
|
||||
{% set dns_list = system_cfg.network.dns.servers | default([]) %}
|
||||
{% set search_list = system_cfg.network.dns.search | default([]) %}
|
||||
{% if system_cfg.network.ip is defined and system_cfg.network.ip | string | length %}
|
||||
address1={{ system_cfg.network.ip }}/{{ system_cfg.network.prefix }}{{ (',' ~ system_cfg.network.gateway) if (system_cfg.network.gateway is defined and system_cfg.network.gateway | string | length) else '' }}
|
||||
method=manual
|
||||
{% else %}
|
||||
method=auto
|
||||
|
||||
Reference in New Issue
Block a user