-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed to use template files #13
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
1 change: 1 addition & 0 deletions
1
packetnetworking/distros/debian/templates/bonded/etc_modules.j2
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bonding |
54 changes: 54 additions & 0 deletions
54
packetnetworking/distros/debian/templates/bonded/etc_network_interfaces.j2
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
auto lo | ||
iface lo inet loopback | ||
|
||
auto bond0 | ||
iface bond0 inet static | ||
{% if ip4pub %} | ||
address {{ ip4pub.address }} | ||
netmask {{ ip4pub.netmask }} | ||
gateway {{ ip4pub.gateway }} | ||
{% else %} | ||
address {{ ip4priv.address }} | ||
netmask {{ ip4priv.netmask }} | ||
gateway {{ ip4priv.gateway }} | ||
{% endif %} | ||
bond-downdelay 200 | ||
bond-miimon 100 | ||
bond-mode {{ net.bonding.mode }} | ||
bond-updelay 200 | ||
bond-xmit_hash_policy layer3+4 | ||
{% if osinfo.distro == 'ubuntu' and net.bonding.mode == 4 %} | ||
bond-lacp-rate 1 | ||
{% endif %} | ||
bond-slaves{% for iface in interfaces %} {{ iface.name }}{% endfor %} | ||
|
||
dns-nameservers{% for dns in resolvers %} {{ dns }}{% endfor %} | ||
|
||
{% if ip6pub %} | ||
iface bond0 inet6 static | ||
address {{ ip6pub.address }} | ||
netmask {{ ip6pub.cidr }} | ||
gateway {{ ip6pub.gateway }} | ||
{% endif %} | ||
|
||
{% if ip4pub %} | ||
auto bond0:0 | ||
iface bond0:0 inet static | ||
address {{ ip4priv.address }} | ||
netmask {{ ip4priv.netmask }} | ||
{% for subnet in private_subnets %} | ||
post-up route add -net {{ subnet }} gw {{ ip4priv.gateway }} | ||
post-down route del -net {{ subnet }} gw {{ ip4priv.gateway }} | ||
{% endfor %} | ||
{% endif %} | ||
{% if osinfo.distro == 'ubuntu' %} | ||
{% for iface in interfaces %} | ||
|
||
auto {{ iface.name }} | ||
iface {{ iface.name }} inet manual | ||
{% if iface.name != interfaces[0].name %} | ||
pre-up sleep 4 | ||
{% endif %} | ||
bond-master bond0 | ||
{% endfor %} | ||
{% endif %} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{ hostname }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
127.0.0.1 localhost {{ hostname }} | ||
|
||
# The following lines are desirable for IPv6 capable hosts | ||
::1 localhost ip6-localhost ip6-loopback | ||
ff02::1 ip6-allnodes | ||
ff02::2 ip6-allrouters |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% for server in resolvers %} | ||
nameserver {{ server }} | ||
{% endfor %} |
34 changes: 34 additions & 0 deletions
34
packetnetworking/distros/debian/templates/individual/etc_network_interfaces.j2
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
auto lo | ||
iface lo inet loopback | ||
|
||
auto {{ iface0.name }} | ||
iface {{ iface0.name }} inet static | ||
{% if ip4pub %} | ||
address {{ ip4pub.address }} | ||
netmask {{ ip4pub.netmask }} | ||
gateway {{ ip4pub.gateway }} | ||
{% else %} | ||
address {{ ip4priv.address }} | ||
netmask {{ ip4priv.netmask }} | ||
gateway {{ ip4priv.gateway }} | ||
{% endif %} | ||
|
||
dns-nameservers{% for dns in resolvers %} {{ dns }}{% endfor %} | ||
|
||
{% if ip6pub %} | ||
iface {{ iface0.name }} inet6 static | ||
address {{ ip6pub.address }} | ||
netmask {{ ip6pub.cidr }} | ||
gateway {{ ip6pub.gateway }} | ||
{% endif %} | ||
|
||
{% if ip4pub %} | ||
auto {{ iface0.name }}:0 | ||
iface {{ iface0.name }}:0 inet static | ||
address {{ ip4priv.address }} | ||
netmask {{ ip4priv.netmask }} | ||
{% for subnet in private_subnets %} | ||
post-up route add -net {{ subnet }} gw {{ ip4priv.gateway }} | ||
post-down route del -net {{ subnet }} gw {{ ip4priv.gateway }} | ||
{% endfor %} | ||
{% endif %} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't like the way this looked and went looking for some better looking code, but I only came up with:
and I'm not so sure its better. It does have the benefit of not needing to iterate through the whole list only to keep 1 item though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah, good catch, much cleaner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minus the typo. It should be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated