27 lines
722 B
YAML
27 lines
722 B
YAML
---
|
|
- name: Check that the deprecated netconfig file exists
|
|
become: true
|
|
stat:
|
|
path: /etc/sysconfig/network-scripts/ifcfg-eth0
|
|
register: deprecated_netconf
|
|
|
|
- name: Migrate to newer NetworkManager config
|
|
when: deprecated_netconf.stat.exists
|
|
become: true
|
|
ansible.builtin.command: nmcli connection migrate
|
|
|
|
- name: Setup a service endpoint ipv4
|
|
become: true
|
|
notify:
|
|
- Restart NetworkManager
|
|
community.general.nmcli:
|
|
conn_name: 'System eth0'
|
|
ifname: eth0
|
|
type: ethernet
|
|
ip4:
|
|
- "{{ service_entrypoint }}/32"
|
|
- "{{ user_entrypoint }}/32"
|
|
method4: auto
|
|
mac: "{{hostvars[inventory_hostname].ansible_default_ipv4.macaddress}}"
|
|
autoconnect: true
|
|
state: present |