This commit is contained in:
2024-06-14 10:38:25 +08:00
commit 133692dcb4
9 changed files with 159 additions and 0 deletions

16
update-gateway.yaml Normal file
View File

@@ -0,0 +1,16 @@
- name: Update default route
hosts: all
become: yes
user: root
vars_prompt:
- name: "gateway_ip"
prompt: "Enter the gateway IP address"
private: no
tasks:
- name: Delete the default route
command: ip route delete default
ignore_errors: yes # Ignore errors in case the default route does not exist
- name: Add the new default route
command: ip route add default via {{ gateway_ip }}