Last active
March 9, 2016 00:15
-
-
Save danehans/7dc04f49ea220af5aaaa to your computer and use it in GitHub Desktop.
ansible_networkd_route_mgt
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
| TASK: [Create internal networkd file] ***************** | |
| fatal: [172.22.111.161] => {'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'list' object has no attribute 'split'", 'failed': True} | |
| fatal: [172.22.111.161] => {'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'list' object has no attribute 'split'", 'failed': True} |
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
| manage_internal_network: true | |
| # Add internal routes in the form of: | |
| # destination_network,destination_mask,next_hop_ip | |
| # Example: - 192.168.0.0,/16,192.168.111.192 | |
| internal_routes: | |
| - 192.168.0.0,/16,192.168.111.192 |
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
| internal_interface: enp11s0 | |
| internal_ip: 192.168.111.161 | |
| internal_cidr: /24 |
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
| [Match] | |
| Name={{ internal_interface }} | |
| [Network] | |
| Address={{ internal_ip }}{{ internal_cidr }} | |
| {% for route in internal_routes %} | |
| {% set route_list = internal_routes.split(',') %} | |
| [Route] | |
| Destination={{ route_list[0] }}{{ route_list[1] }} | |
| Gateway={{ route_list[2] }} | |
| {% endfor %} |
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: Manage networkd file | |
| template: src=networkd.j2 dest=/etc/systemd/network/{{ internal_interface }}.network | |
| notify: | |
| - restart systemd-networkd | |
| - systemd-resolved | |
| when: manage_internal_network |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment