server-config/vagrant/roles/rename-nic/tasks/rename-nic.yml

41 lines
1.3 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
# Cambio nome interfacce
- name: Rinomino interfaccia esterna
replace:
dest: /etc/udev/rules.d/70-persistent-net.rules
regexp: 'eth0'
replace: '{{ extnic }}'
become: yes
- name: Creo interfaccia esterna in NethServer
shell: /sbin/e-smith/db networks set {{ extnic }} ethernet bootproto dhcp device {{ extnic }} hwaddr {{ ansible_eth0.macaddress }} onboot yes peerdns yes role red
become: yes
- name: Pulizia vecchia interfaccia esterna
shell: /sbin/e-smith/db networks delete eth0
become: yes
- name: Rinomino interfaccia interna
replace:
dest: /etc/udev/rules.d/70-persistent-net.rules
regexp: 'eth1'
replace: '{{ intnic }}'
become: yes
- name: Creo interfaccia interna in NethServer
shell: /sbin/e-smith/db networks set {{ intnic }} ethernet bootproto none device {{ intnic }} hwaddr {{ ansible_eth1.macaddress }} ipaddr 172.16.254.1 netmask 255.255.255.0 onboot yes role green
become: yes
- name: Pulizia vecchia interfaccia interna
shell: /sbin/e-smith/db networks delete eth1
become: yes
# Forzo il processo a tornare zero, altrimenti non va.
- name: Ricreo le interfacce
shell: udevadm control --reload-rules && udevadm trigger --attr-match=subsystem=net
become: yes
- name: Segnalo il cambiamento a livello di interfacce
shell: /sbin/e-smith/signal-event interface-update
become: yes