I use this for rhel/foreman:
init.pp
class network {
tag("bootstrap")
file { "ifcfg-eth0":
path =>
"/etc/sysconfig/network-scripts/ifcfg-eth0",
owner => root,
group => root,
mode => 644,
content => template("network/ifcfg.erb"),
ensure => present,
notify => Service[network],
}
file { "network":
path => "/etc/sysconfig/network",
owner => root,
group => root,
mode => 644,
content => template("network/network.erb"),
notify => Service[network],
}
service { network:
ensure => "running",
hasstatus => "true",
hasrestart => "true",
restart => "/etc/init.d/network restart",
}
}
[r...@hlslinutil1]/root/puppet/modules/testing/network/templates# cat
ifcfg.erb
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
TYPE=Ethernet
IPADDR=<%= ip %>
BROADCAST=xxx
NETMASK=xxx
NETWORK=xxx
[r...@hlslinutil1]/root/puppet/modules/testing/network/templates# cat
network.erb
NETWORKING=yes
HOSTNAME=<%= fqdn %>
GATEWAY=10.241.209.1
I actually have it slightly more complicated as I modified foreman to
provide ip and then I have extra checks in the erb like:
<% if ip =~ /10.241.209/ %>
BROADCAST=10.241.209.255
NETMASK=255.255.255.0
NETWORK=10.241.209.0
Hopefully that'll start you on the right path.
On Tue, Jul 6, 2010 at 8:17 AM, SyRenity <[email protected]> wrote:
> > We would need a lot more information to be helpful - what OS are you
> using,
> > or what distribution if Linux, and how do you want to control the ip's
> for
> > machines - variables, a database, ldap?
>
> CentOS 5.5, variables for now.
>
> I'm using foreman, so storing these values in DB comes with it.
>
> Regards.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<puppet-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.