Skip to content

Commit

Permalink
make interface to disable ipv6 on configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
maguec committed Apr 20, 2018
1 parent 41f407c commit e6b2095
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions manifests/resolv.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#adds some options to resolv.conf to behave better in a cloud environment

$primary_interface = $::networking['primary']

file { '/etc/resolvconf/resolv.conf.d/head':
ensure => present,
owner => root,
Expand All @@ -25,7 +27,7 @@
owner => root,
group => root,
mode => '0644',
source => 'puppet:///modules/ec2base/disable-ipv6.service',
content => template('ec2base/disable-ipv6.service.erb'),
notify => Exec['systemctl_reload_disable-ipv6', 'hard_disable-ipv6'],
}

Expand All @@ -35,7 +37,7 @@
}

exec { 'hard_disable-ipv6':
command => '/bin/echo 1 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6',
command => "/bin/echo 1 > /proc/sys/net/ipv6/conf/${primary_interface}/disable_ipv6",
refreshonly => true,
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#################################################################################################
# Puppet Controlled
#################################################################################################
#
[Unit]
Description=Disable IPV6 entirely
Before=network-online.target

[Service]
User=root
Type=oneshot
ExecStart=/bin/echo 1 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6
ExecStart=/bin/echo 1 > /proc/sys/net/ipv6/conf/<%= @primary_interface %>/disable_ipv6
RemainAfterExit=true
StandardOutput=journal

Expand Down

0 comments on commit e6b2095

Please sign in to comment.