28 lines
No EOL
706 B
YAML
28 lines
No EOL
706 B
YAML
|
|
- name: Configure static IP address (using Network Manager).
|
|
become: yes
|
|
community.general.nmcli:
|
|
conn_name: "Multimedia net"
|
|
ifname: eth0
|
|
type: ethernet
|
|
ip4: "{{ static_ip_address }}/{{ static_ip_netmask | ansible.utils.ipaddr('prefix') }}"
|
|
gw4: "{{static_ip_gateway}}"
|
|
state: present
|
|
|
|
- name: Restart NetworkManager
|
|
become: yes
|
|
service:
|
|
name: NetworkManager
|
|
state: restarted
|
|
|
|
- name: Wait for network to be available
|
|
become: yes
|
|
wait_for_connection:
|
|
timeout: 60
|
|
|
|
# TODO: get rid of netaddr
|
|
- name: Display new IP configuration
|
|
debug:
|
|
msg: "Static IP configured: {{ static_ip_address }}/{{ static_ip_netmask | ansible.utils.ipaddr('prefix') }}"
|
|
|
|
|