-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid need to preprocess redhat templates
This was quite ugly to see. Turns out we could just pass in the extra stuff via context and just use them in the template logic and it all works out. No need to escape `{` and `}` any more.
- Loading branch information
Showing
7 changed files
with
52 additions
and
52 deletions.
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
46 changes: 23 additions & 23 deletions
46
...etnetworking/distros/redhat/templates/bonded/etc_sysconfig_network-scripts_ifcfg-bondX.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 |
---|---|---|
@@ -1,29 +1,29 @@ | ||
DEVICE={bond} | ||
NAME={bond} | ||
{{% if "{bond}" == "bond0" %}} | ||
{{% if ip4pub %}} | ||
IPADDR={{{{ ip4pub.address }}}} | ||
NETMASK={{{{ ip4pub.netmask }}}} | ||
GATEWAY={{{{ ip4pub.gateway }}}} | ||
{{% else %}} | ||
IPADDR={{{{ ip4priv.address }}}} | ||
NETMASK={{{{ ip4priv.netmask }}}} | ||
GATEWAY={{{{ ip4priv.gateway }}}} | ||
{{% endif %}} | ||
{{% endif %}} | ||
DEVICE={{bond}} | ||
NAME={{bond}} | ||
{% if bond == "bond0" %} | ||
{% if ip4pub %} | ||
IPADDR={{ ip4pub.address }} | ||
NETMASK={{ ip4pub.netmask }} | ||
GATEWAY={{ ip4pub.gateway }} | ||
{% else %} | ||
IPADDR={{ ip4priv.address }} | ||
NETMASK={{ ip4priv.netmask }} | ||
GATEWAY={{ ip4priv.gateway }} | ||
{% endif %} | ||
{% endif %} | ||
BOOTPROTO=none | ||
ONBOOT=yes | ||
USERCTL=no | ||
TYPE=Bond | ||
BONDING_OPTS="mode={{{{ net.bonding.mode }}}} miimon=100 downdelay=200 updelay=200" | ||
BONDING_OPTS="mode={{ net.bonding.mode }} miimon=100 downdelay=200 updelay=200" | ||
|
||
{{% if "{bond}" == "bond0" %}} | ||
{{% if ip6pub %}} | ||
{% if bond == "bond0" %} | ||
{% if ip6pub %} | ||
IPV6INIT=yes | ||
IPV6ADDR={{{{ ip6pub.address }}}}/{{{{ ip6pub.cidr }}}} | ||
IPV6_DEFAULTGW={{{{ ip6pub.gateway }}}} | ||
{{% endif %}} | ||
{{% endif %}} | ||
{{% for dns in resolvers %}} | ||
DNS{{{{ loop.index }}}}={{{{ dns }}}} | ||
{{% endfor %}} | ||
IPV6ADDR={{ ip6pub.address }}/{{ ip6pub.cidr }} | ||
IPV6_DEFAULTGW={{ ip6pub.gateway }} | ||
{% endif %} | ||
{% endif %} | ||
{% for dns in resolvers %} | ||
DNS{{ loop.index }}={{ dns }} | ||
{% endfor %} |
16 changes: 8 additions & 8 deletions
16
...networking/distros/redhat/templates/bonded/etc_sysconfig_network-scripts_ifcfg-bondX_0.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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
DEVICE={bond}:0 | ||
NAME={bond}:0 | ||
IPADDR={{{{ ip4priv.address }}}} | ||
NETMASK={{{{ ip4priv.netmask }}}} | ||
GATEWAY={{{{ ip4priv.gateway }}}} | ||
DEVICE={{bond}}:0 | ||
NAME={{bond}}:0 | ||
IPADDR={{ ip4priv.address }} | ||
NETMASK={{ ip4priv.netmask }} | ||
GATEWAY={{ ip4priv.gateway }} | ||
BOOTPROTO=none | ||
ONBOOT=yes | ||
USERCTL=no | ||
{{% for dns in resolvers %}} | ||
DNS{{{{ loop.index }}}}={{{{ dns }}}} | ||
{{% endfor %}} | ||
{% for dns in resolvers %} | ||
DNS{{ loop.index }}={{ dns }} | ||
{% endfor %} |
6 changes: 3 additions & 3 deletions
6
...etworking/distros/redhat/templates/bonded/etc_sysconfig_network-scripts_ifcfg-template.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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
DEVICE={iface} | ||
DEVICE={{iface}} | ||
ONBOOT=yes | ||
HWADDR={{{{ interfaces[{i}].mac }}}} | ||
MASTER={{{{ interfaces[{i}].bond }}}} | ||
HWADDR={{ interfaces[i].mac }} | ||
MASTER={{ interfaces[i].bond }} | ||
SLAVE=yes | ||
BOOTPROTO=none |
6 changes: 3 additions & 3 deletions
6
...etnetworking/distros/redhat/templates/bonded/etc_sysconfig_network-scripts_route-bondX.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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{{% for subnet in private_subnets %}} | ||
{{{{ subnet }}}} via {{{{ ip4priv.gateway }}}} dev {bond}:0 | ||
{{% endfor %}} | ||
{% for subnet in private_subnets %} | ||
{{ subnet }} via {{ ip4priv.gateway }} dev {{bond}}:0 | ||
{% endfor %} |
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