Files
ansible/update-gateway.yaml
2024-06-14 10:38:25 +08:00

17 lines
437 B
YAML

- 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 }}