predavalnice-kontroler/ansible_deploy/display/static_ip.yml

32 lines
880 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 }}/{{ static_ip_cidr }}"
# Sorry timi
method6: disabled
# Multimedia net doesn't have Internet access, so this iface shouldn't be used for Internet access
never_default4: true
routes4_extended:
- ip: 192.168.0.0/16
next_hop: "{{ static_ip_gateway }}"
metric: 9999
- ip: 10.0.0.0/8
next_hop: "{{ static_ip_gateway }}"
metric: 9999
# gw4: "{{ static_ip_gateway }}"
state: present
conn_reload: true
- name: Wait for network to be available
become: yes
wait_for_connection:
timeout: 60
- name: Display new IP configuration
debug:
msg: "Static IP configured: {{ static_ip }}/{{ static_ip_cidr }}"