Update update-default-route.yml
This commit is contained in:
@@ -1,20 +1,10 @@
|
||||
---
|
||||
- name: Update default gateway
|
||||
hosts: proxmox_nodes
|
||||
become: true
|
||||
vars:
|
||||
new_gateway: "192.168.1.254"
|
||||
|
||||
tasks:
|
||||
- name: Replace gateway line in interfaces file
|
||||
lineinfile:
|
||||
path: /etc/network/interfaces
|
||||
regexp: '^(\s*)gateway\s+'
|
||||
line: " gateway {{ new_gateway }}"
|
||||
backrefs: yes
|
||||
|
||||
- name: Apply new default route immediately
|
||||
command: ip route replace default via {{ new_gateway }}
|
||||
command: ip route replace default via 192.168.1.254
|
||||
|
||||
- name: Restart networking
|
||||
systemd:
|
||||
|
||||
Reference in New Issue
Block a user