Include MAC-Address into the NetworkManager keyfile

This commit is contained in:
Sandwich 2024-10-31 00:13:23 +01:00
parent ec55701f00
commit af82baf1d8
3 changed files with 10 additions and 2 deletions

View File

@ -179,6 +179,7 @@ rhel8:
- open-vm-tools - open-vm-tools
- shim - shim
- telnet - telnet
- vim
- zstd - zstd
rhel9: rhel9:
@ -193,6 +194,7 @@ rhel9:
- open-vm-tools - open-vm-tools
- shim - shim
- telnet - telnet
- vim
- zstd - zstd
rocky: rocky:

View File

@ -204,6 +204,11 @@
changed_when: net_inf.rc == 0 changed_when: net_inf.rc == 0
register: net_inf register: net_inf
- name: Register MAC Address of the Network Interface
ansible.builtin.shell: ip link show "{{ net_inf.stdout }}" | awk '/link\/ether/ {print $2}' | tr '[:lower:]' '[:upper:]'
register: net_mac
changed_when: net_mac.rc == 0
- name: Copy NetworkManager keyfile - name: Copy NetworkManager keyfile
ansible.builtin.template: ansible.builtin.template:
src: network.j2 src: network.j2

View File

@ -5,6 +5,7 @@ type=ethernet
interface-name={{ net_inf.stdout }} interface-name={{ net_inf.stdout }}
[ethernet] [ethernet]
mac-address={{ net_mac.stdout }}
[ipv4] [ipv4]
address={{ vm_ip }},{{ vm_gw }} address={{ vm_ip }},{{ vm_gw }}
@ -12,7 +13,7 @@ dns={{ vm_dns }}
method=manual method=manual
[ipv6] [ipv6]
addr-gen-mode=default addr-gen-mode=stable-privacy
method=disabled method=disabled
[proxy] [proxy]