From bd467148c4bea0ac42d3b8705371e1dfb0b362b9 Mon Sep 17 00:00:00 2001 From: Andres Moya <andres.moya.i@gmail.com> Date: Wed, 9 Sep 2020 09:43:10 -0700 Subject: [PATCH] added RH ipv6 general params, kept backward compatible with ipv6enable --- manifests/init.pp | 38 +++++++++++++++++++++++++++++++++++ templates/hostname-RedHat.erb | 19 ++++++++++++++++-- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index c4b090b..d65d2d4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -98,7 +98,12 @@ class network ( $gateway = undef, $nozeroconf = undef, $ipv6enable = undef, + $networking_ipv6 = undef, + $ipv6forwarding = undef, $ipv6_autoconf = undef, + $ipv6_autotunnel = undef, + $ipv6_defaultgw = undef, + $ipv6_radvd_pidfile = undef, # Stdmod commons $package_name = $::network::params::package_name, @@ -231,6 +236,39 @@ class network ( $config_file_ensure = present } + $manage_networking_ipv6 = $networking_ipv6 ? { + 'yes' => 'yes', + 'no' => 'no', + default => undef, + } + $manage_ipv6forwarding = $ipv6forwarding ? { + 'yes' => 'yes', + 'no' => 'no', + default => undef, + } + $manage_ipv6_autoconf = $ipv6_autoconf ? { + 'yes' => 'yes', + 'no' => 'no', + default => undef, + } + $manage_ipv6_autotunnel = $ipv6_autotunnel ? { + 'yes' => 'yes', + 'no' => 'no', + default => undef, + } + if $ipv6_defaultgw { + if $ipv6_defaultgw =~ Stdlib::IP::Address::V6 { + $manage_ipv6_defaultgw = $ipv6_defaultgw + } else { + notify {"wrong IPv6 default gateway address: $ipv6_defaultgw":} + err ("wrong IPv6 default gateway address: $ipv6_defaultgw") + } + } + if $ipv6_radvd_pidfile =~ Stdlib::Absolutepath { + $manage_ipv6_radvd_pidfile = $ipv6_radvd_pidfile + } else { + $manage_ipv6_radvd_pidfile = undef + } # Dependency class diff --git a/templates/hostname-RedHat.erb b/templates/hostname-RedHat.erb index e484461..756a085 100644 --- a/templates/hostname-RedHat.erb +++ b/templates/hostname-RedHat.erb @@ -9,9 +9,24 @@ NOZEROCONF="<%= @nozeroconf %>" <% if @ipv6enable -%> NETWORKING_IPV6="<%= @ipv6enable %>" IPV6INIT="<%= @ipv6enable %>" -<% if @ipv6_autoconf -%> -IPV6_AUTOCONF="<%= @ipv6_autoconf %>" <% end -%> +<% if @manage_networking_ipv6 -%> +NETWORKING_IPV6="<%= @manage_networking_ipv6 %>" +<% end -%> +<% if @manage_ipv6forwarding -%> +IPV6FORWARDING="<%= @manage_ipv6forwarding %>" +<% end -%> +<% if @manage_ipv6_autoconf -%> +IPV6_AUTOCONF="<%= @manage_ipv6_autoconf %>" +<% end -%> +<% if @manage_ipv6_autotunnel -%> +IPV6_AUTOTUNNEL="<%= @manage_ipv6_autotunnel %>" +<% end -%> +<% if @manage_ipv6_defaultgw -%> +IPV6_DEFAULTGW="<%= @manage_ipv6_defaultgw %>" +<% end -%> +<% if @manage_ipv6_radvd_pidfile -%> +IPV6_RADVD_PIDFILE="<%= @manage_ipv6_radvd_pidfile %>" <% end -%> <% if @hostname -%>HOSTNAME="<%= @hostname %>" <%- else %>HOSTNAME="<%= @manage_hostname.split('.').first %>" -- GitLab