Skip to content

Commit

Permalink
Empty commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
aybarsm committed Jun 27, 2024
1 parent 0ec4d85 commit c6c8963
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions roles/network_interfaces/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ linux_network_interfaces_source_line: "source {{ linux_network_interfaces_seggre
linux_network_interfaces_backup: true
linux_network_interfaces_template: network_interfaces.j2

# iface XXX inet {manual|static|dhcp}
# Manual method only INCLUDES selected options whereas static and dhcp methods EXCLUDES selected options
linux_network_interfaces_manual_includes: []
linux_network_interfaces_static_excludes: []
linux_network_interfaces_dhcp_excludes: [
'address', 'netmask', 'gateway', 'broadcast', 'network', 'dns-nameservers', 'dns-search',
Expand Down
4 changes: 2 additions & 2 deletions roles/network_interfaces/templates/network_interfaces.j2
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ iface lo inet loopback
{% for addr_family in ['inet', 'inet6'] %}
{% if addr_family in iface %}
{% set ifaceMethod = iface[addr_family] | selectattr('name', 'equalto', 'method') | map(attribute='value') | first | default('') %}
{% if ifaceMethod in ['static', 'dhcp'] %}
{% if ifaceMethod in ['static', 'dhcp', 'manual'] %}
iface {{ iface.name }} {{ addr_family }} {{ ifaceMethod }}
{% set ifaceParamsExclude = linux_network_interfaces_dhcp_excludes | default([]) if ifaceMethod == 'dhcp' else linux_network_interfaces_static_excludes | default([]) %}
{% set ifaceParamsExclude = ifaceParamsExclude + ['method'] %}
{% set ifaceParams = iface[addr_family] | rejectattr('name', 'in', ifaceParamsExclude) %}
{% if ifaceParams | length > 0 %}
{{ ifaceParams | flatten_query('name', 'value', ' ', '\n') | indent(4, true) }}
{{ ifaceParams | aybarsm.helper.flatten_query('name', 'value', ' ', '\n') | indent(4, true) }}
{% endif %}

{% endif %}
Expand Down

0 comments on commit c6c8963

Please sign in to comment.