Hi guys Am new to puppet so please take it easy on me. I want to know how can I add lines to hosts file on the client machine, I am trying to add a couple of IP addresses to the hosts file on client and I dont want to overwrite their hosts file, just add new stuff in there. My server and client both are running Ubuntu. Thanks -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
You can add new entries using the ''host'' type: http://docs.puppetlabs.com/references/stable/type.html#host For example: host { "myhostname": ip => "1.1.1.1", } By itself, it won''t remove existing entries (but there is a way to do this as well using purging). If you haven''t read it already, there is a language guide which explains using resources in more detail: http://docs.puppetlabs.com/guides/language_guide.html#resources ken. On Fri, Jul 8, 2011 at 3:45 PM, newguy <aimanparvaiz@gmail.com> wrote:> Hi guys > Am new to puppet so please take it easy on me. > I want to know how can I add lines to hosts file on the client > machine, I am trying to add a couple of IP addresses to the hosts file > on client and I dont want to overwrite their hosts file, just add new > stuff in there. > My server and client both are running Ubuntu. > > Thanks > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. > >-- "Join us for PuppetConf, September 22nd and 23rd in Portland, OR: http://bit.ly/puppetconfsig" -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thanks for this help Ken, one more question please, suppose I want to add the following lines in the smb.conf file already existing on the client machine: [USERNAME] path = /home/USERNAME available = yes valid users = XYZ read only =yes How can I add lines to smb.conf with out overwriting the content of the file. On Jul 8, 7:48 am, Ken Barber <k...@puppetlabs.com> wrote:> You can add new entries using the ''host'' type: > > http://docs.puppetlabs.com/references/stable/type.html#host > > For example: > > host { "myhostname": > ip => "1.1.1.1", > > } > > By itself, it won''t remove existing entries (but there is a way to do > this as well using purging). > > If you haven''t read it already, there is a language guide which > explains using resources in more detail: > > http://docs.puppetlabs.com/guides/language_guide.html#resources > > ken. > > > > > > > > > > On Fri, Jul 8, 2011 at 3:45 PM, newguy <aimanparv...@gmail.com> wrote: > > Hi guys > > Am new to puppet so please take it easy on me. > > I want to know how can I add lines to hosts file on the client > > machine, I am trying to add a couple of IP addresses to the hosts file > > on client and I dont want to overwrite their hosts file, just add new > > stuff in there. > > My server and client both are running Ubuntu. > > > Thanks > > > -- > > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > > To post to this group, send email to puppet-users@googlegroups.com. > > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > > For more options, visit this group athttp://groups.google.com/group/puppet-users?hl=en. > > -- > "Join us for PuppetConf, September 22nd and 23rd in Portland, OR:http://bit.ly/puppetconfsig"-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Rob McBroom
2011-Jul-08 16:54 UTC
Re: [Puppet Users] Re: add lines to /etc/hosts on client
On Jul 8, 2011, at 12:45 PM, newguy wrote:> How can I add lines to smb.conf with out overwriting the content of > the file.I think Augeas is what you’re looking for (for this and other inevitable use cases). http://projects.puppetlabs.com/projects/puppet/wiki/Puppet_Augeas -- Rob McBroom <http://www.skurfer.com/> -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thanks Rob but what if I simple decide to remove the existing smb.conf file and push the new smb.conf from the server, I know I can use the source to tell which file to install and its location but how would I remove the smb.conf from the client. On Jul 8, 9:54 am, Rob McBroom <mailingli...@skurfer.com> wrote:> On Jul 8, 2011, at 12:45 PM, newguy wrote: > > > How can I add lines to smb.conf with out overwriting the content of > > the file. > > I think Augeas is what you’re looking for (for this and other inevitable use cases). > > http://projects.puppetlabs.com/projects/puppet/wiki/Puppet_Augeas > > -- > Rob McBroom > <http://www.skurfer.com/>-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Rob McBroom
2011-Jul-08 18:04 UTC
Re: [Puppet Users] Re: add lines to /etc/hosts on client
On Jul 8, 2011, at 1:52 PM, newguy wrote:> Thanks Rob but what if I simple decide to remove the existing smb.conf > file and push the new smb.conf from the server, I know I can use the > source to tell which file to install and its location but how would I > remove the smb.conf from the client.If you push a file from the server, the old one will be completely replaced (if there are any differences between it and the new one). The original should get stored away in the client’s file bucket. If you want to remove a file only, you can use “ensure => absent”. I’m not sure what you’re asking, but hopefully the answer’s in there somewhere. -- Rob McBroom <http://www.skurfer.com/> -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Rob I am writing a module for installing Haproxy on client machine and I want modified haproxy.cfg and modified /etc/init.d/haproxy to be installed on the client. Here is my code but teh files are not getting to the client machine: class haproxy::install { package { "haproxy": ensure =>present, } } class haproxy::init { file { "/etc/init.d/haproxy": ensure => present, owner => ''root'', group => ''root'', mode => 0600, source => "puppet:///modules/haproxy/haroxy", require => Class["haproxy::install"], } } class haproxy::cfg { file { "/etc/haproxy/haproxy.cfg": ensure => present, owner => ''root'', group => ''root'', mode => 0600, source => "puppet:///modules/haproxy/haroxy.cfg", require => Class["haproxy::install"], } } class haproxy { include haproxy::install, haproxy::init, haproxy::cfg } Client shows the following error: err: //haproxy::init/File[/etc/init.d/haproxy]: Failed to retrieve current state of resource: Could not retrieve information from source(s) puppet:///modules/haproxy/haroxy at /etc/puppet/modules/ haproxy/manifests/init.pp:17 err: //haproxy::cfg/File[/etc/haproxy/haproxy.cfg]: Failed to retrieve current state of resource: Could not retrieve information from source(s) puppet:///modules/haproxy/haroxy.cfg at /etc/puppet/modules/ haproxy/manifests/init.pp:29 On Jul 8, 11:04 am, Rob McBroom <mailingli...@skurfer.com> wrote:> On Jul 8, 2011, at 1:52 PM, newguy wrote: > > > Thanks Rob but what if I simple decide to remove the existing smb.conf > > file and push the new smb.conf from the server, I know I can use the > > source to tell which file to install and its location but how would I > > remove the smb.conf from the client. > > If you push a file from the server, the old one will be completely replaced (if there are any differences between it and the new one). The original should get stored away in the client’s file bucket. If you want to remove a file only, you can use “ensure => absent”. I’m not sure what you’re asking, but hopefully the answer’s in there somewhere. > > -- > Rob McBroom > <http://www.skurfer.com/>-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jacob Helwig
2011-Jul-08 18:22 UTC
Re: [Puppet Users] Re: add lines to /etc/hosts on client
On Fri, 08 Jul 2011 11:18:57 -0700, newguy wrote:> > class haproxy::init { > file { "/etc/init.d/haproxy": > ensure => present, > owner => ''root'', > group => ''root'', > mode => 0600, > source => "puppet:///modules/haproxy/haroxy",Got a typo in the source URI here. Should be ''haproxy'', instead of ''haroxy'' at the end. -- Jacob Helwig
Thanks dude, there was another typo too, fixed both and it worked, thanks everyone. On Jul 8, 11:22 am, Jacob Helwig <ja...@puppetlabs.com> wrote:> On Fri, 08 Jul 2011 11:18:57 -0700, newguy wrote: > > > class haproxy::init { > > file { "/etc/init.d/haproxy": > > ensure => present, > > owner => ''root'', > > group => ''root'', > > mode => 0600, > > source => "puppet:///modules/haproxy/haroxy", > > Got a typo in the source URI here. Should be ''haproxy'', instead of > ''haroxy'' at the end. > > -- > Jacob Helwig > > signature.asc > < 1KViewDownload-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.