diff options
author | Tim Rozet <trozet@redhat.com> | 2015-10-19 17:15:00 -0400 |
---|---|---|
committer | Tim Rozet <trozet@redhat.com> | 2015-10-20 18:46:30 +0000 |
commit | c69c811e742a33f135aa3b13517be4db75f6fcf0 (patch) | |
tree | d8e479ea5c420b576231184bc15903d2f0c79954 /common/puppet-opnfv | |
parent | c5721ee373f8bd2669a0a45fce75d9ee95ce4c70 (diff) |
Configures static ip on private and admin interfaces for nodes
Change-Id: I5e9608cfe24faf1bd9a8c57076926ef42c013777
Signed-off-by: Tim Rozet <trozet@redhat.com>
(cherry picked from commit 2cc509ae8b90b35aafaae2c984f301c479ec4264)
Diffstat (limited to 'common/puppet-opnfv')
-rw-r--r-- | common/puppet-opnfv/manifests/external_net_presetup.pp | 59 |
1 files changed, 54 insertions, 5 deletions
diff --git a/common/puppet-opnfv/manifests/external_net_presetup.pp b/common/puppet-opnfv/manifests/external_net_presetup.pp index f52b903..43866c1 100644 --- a/common/puppet-opnfv/manifests/external_net_presetup.pp +++ b/common/puppet-opnfv/manifests/external_net_presetup.pp @@ -27,12 +27,61 @@ class opnfv::external_net_presetup { if ($admin_network != '') and ($admin_network != 'false') { $admin_nic = get_nic_from_network("$admin_network") if $admin_nic == '' { fail('admin_nic was not found') } - #Disable defalute route on Admin network - file_line { 'disable-defroute-admin': - path => "/etc/sysconfig/network-scripts/ifcfg-$admin_nic", - line => 'DEFROUTE=no', - match => '^DEFROUTE', + $admin_ip = get_ip_from_nic("admin_nic") + $admin_netmask = get_netmask_from_nic("$admin_nic") + #Modify ifcfg Admin network + augeas { "main-$admin_nic": + context => "/files/etc/sysconfig/network-scripts/ifcfg-$public_nic", + changes => [ + "set IPADDR $admin_ip", + "set NETMASK $admin_netmask", + "rm GATEWAY", + "rm DNS1", + "set DEFROUTE no", + "rm IPV6_DEFROUTE", + "rm IPV6_PEERDNS", + "rm IPV6_PEERROUTES", + "rm PEERROUTES", + "set PEERDNS no", + "set BOOTPROTO static", + "set IPV6INIT no", + "set IPV6_AUTOCONF no", + "set ONBOOT yes", + + ], + before => Exec['systemctl restart network'], + } + + } + + if ($private_network != '') and ($private_network != 'false') { + $private_nic = get_nic_from_network("$private_network") + if $private_nic == '' { fail('private_nic was not found') } + $private_ip = get_ip_from_nic("private_nic") + $private_netmask = get_netmask_from_nic("$private_nic") + #Modify ifcfg private network + augeas { "main-$private_nic": + context => "/files/etc/sysconfig/network-scripts/ifcfg-$private_nic", + changes => [ + "set IPADDR $private_ip", + "set NETMASK $private_netmask", + "rm GATEWAY", + "rm DNS1", + "set DEFROUTE no", + "rm IPV6_DEFROUTE", + "rm IPV6_PEERDNS", + "rm IPV6_PEERROUTES", + "rm PEERROUTES", + "set PEERDNS no", + "set BOOTPROTO static", + "set IPV6INIT no", + "set IPV6_AUTOCONF no", + "set ONBOOT yes", + + ], + before => Exec['systemctl restart network'], } + } #find public NIC |