Created
March 18, 2025 17:07
-
-
Save mistermocha/5eb6f7258714d8d344a73069ea37b6be to your computer and use it in GitHub Desktop.
Does your VPN share a CIDR with your LAN and not use the right gateway? This ansible playbook works to resolve on OSX.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Add a network route | |
hosts: localhost | |
become: yes | |
tasks: | |
- name: Drop any existing network route | |
shell: route -n delete -net 10 {{ ansible_default_ipv4.network }} | |
- name: Add a network route | |
shell: route -n add -net 10 {{ ansible_default_ipv4.network }} | |
- name: Capture the route to inspect for the new gateway | |
shell: route -n get -net 10 | grep gateway | |
register: route | |
- name: Check that the route was added | |
debug: | |
msg: "Route was added: {{ route.stdout }}" | |
when: | |
- route.stdout.find( ansible_default_ipv4.gateway ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment