From 86a6312e60162422033bfc1a3baed2db4742981e Mon Sep 17 00:00:00 2001 From: Khue Doan Date: Sun, 13 Jun 2021 14:23:51 +0700 Subject: [PATCH] Set static IP address --- .../templates/http/ignition/ignition.yaml.j2 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/metal/roles/pxe-boot/templates/http/ignition/ignition.yaml.j2 b/metal/roles/pxe-boot/templates/http/ignition/ignition.yaml.j2 index 971acf27..44668fc3 100644 --- a/metal/roles/pxe-boot/templates/http/ignition/ignition.yaml.j2 +++ b/metal/roles/pxe-boot/templates/http/ignition/ignition.yaml.j2 @@ -14,6 +14,20 @@ storage: mode: 0644 contents: inline: {{ hostvars[item]['inventory_hostname'] }} + - path: /etc/NetworkManager/system-connections/{{ network_interface }}.nmconnection + mode: 0600 + contents: + inline: | + [connection] + id={{ network_interface }} + type=ethernet + interface-name={{ network_interface }} + permissions= + [ipv4] + address1={{ hostvars[item]['ansible_host'] }}/24,{{ ansible_default_ipv4.gateway }} + dns={{ dns_server }}; + dns-search= + method=manual # Set timezone links: - path: /etc/localtime