Hi David, Thanks for you response :)
I have had downloaded puppet agent following that guide. but still i am getting the same error. I have installed ruby-augeas using tar file available on augeas site. I am using augeas-1.5.0 while in logs i am getting following: Debug: Augeas[host_file](provider=augeas): Opening augeas with root /, lens path , flags 32 Debug: Augeas[host_file](provider=augeas): *Augeas version 1.0.0 is installed* Debug: Augeas[host_file](provider=augeas): Unable to optimize files loaded by context path, no glob matches Debug: Augeas[host_file](provider=augeas): Loading failed for one or more files, output from /augeas//error: Debug: Augeas[host_file](provider=augeas): /augeas/files/etc/sudoers/error = parse_failed Debug: Augeas[host_file](provider=augeas): /augeas/files/etc/sudoers/error/pos = 4385 Debug: Augeas[host_file](provider=augeas): /augeas/files/etc/sudoers/error/line = 119 Debug: Augeas[host_file](provider=augeas): /augeas/files/etc/sudoers/error/char = 0 Debug: Augeas[host_file](provider=augeas): /augeas/files/etc/sudoers/error/lens = /usr/share/augeas/lenses/dist/sudoers.aug:531.10-.70: Debug: Augeas[host_file](provider=augeas): /augeas/files/etc/sudoers/error/message = Iterated lens matched less than it should Debug: Augeas[host_file](provider=augeas): /augeas/files/etc/mcollective/server.cfg/error = parse_failed Please help! Regards, Shrawan On Wednesday, 29 June 2016 18:01:30 UTC+5:30, David Lutterkort wrote: > > Hi Shrawan, > > On Tue, Jun 28, 2016 at 8:51 AM, Shrawan Bhagwat <shraw...@gmail.com > <javascript:>> wrote: > >> Hi David, >> >> I am getting following error: >> >> Error: /Stage[main]/Aug_mod::Configuration_files/Augeas[host_file]: Could >> not evaluate: undefined method `set' for #<Augeas:0x7f5eb79ab100> >> > > This indicates that there is something wrong with your installation of > ruby-augeas; that gem consists of some Ruby code and some native code. The > 'set' method is defined in native code. I highly recommend using the > puppet-agent packages; installation instructions can be found here > <https://docs.puppet.com/puppet/latest/reference/install_linux.html> > > Though it's not the reason you are seeing the error message, the resource > in your Puppet code also looks not quite right. You have things like 'set > /chroot/httpd/files/etc/hosts/01/ipaddr 192.168.0.1' in there - I assume > it's to make changes to the file /chroot/httpd/etc/hosts. If that's the > case, you need to both use an explicit 'lens' property (as Augeas won't > know what kind of file /chroot/httpd/etc/hosts is) and the proper path in > Augeas is /files/chroot/httpd/etc/hosts/... - Augeas produces a tree that's > a lot like a file system, the contents of a file F are at /files/F in that > tree, and there's other stuff in that tree, most notably metadata about > files in /augeas/files/F > > Your augeas resource should therefore look something like > > augeas { 'host_file': > lens => 'Hosts.lns', > context => '/files/chroot/httpd/etc/hosts', > changes => [ > 'set 01/ipaddr 192.168.0.1', > 'set 01/canonical pigiron.example.com', > 'set 01/alias[1] pigiron', > 'set 01/alias[2] piggy', > ], > # Only make the above changes if we do not have an entry for 192.168.0.1 > yet > onlyif => "match *[ipaddr='192.168.0.1'] size == 0"; > } > > David > > while the same is working fine with augtool on command line. >> >> Please help. >> >> Regards, >> Shrawan >> >> On Tuesday, 28 June 2016 12:01:06 UTC+5:30, Shrawan Bhagwat wrote: >>> >>> Hi David, >>> >>> Thanks for your response. >>> >>> I have done that as guided in this: >>> http://www.unixarena.com/2016/02/puppet-augeas-edit-system-configuration-files.html >>> >>> Can you please help me with it's working? >>> >>> As of now i have created class for augeas similar to normal modules of >>> puppet in init.pp and declared it in site.pp, but it's throwing an error in >>> it's declaration. >>> >>> So please tell me where i m doing wrong. >>> >>> for changing hosts file: >>> init.pp : >>> class aug_mod{ >>> >>> class{'configuration_files':} >>> include configuration_files >>> >>> >>> # configuration_files { } >>> } >>> >>> configuration_files.pp: >>> class aug_mod::configuration_files{ >>> >>> augeas{'host_file': >>> #lens => 'hosts.aug', >>> context => '/chroot/httpd/files/etc/hosts', >>> changes => [ >>> 'set /chroot/httpd/files/etc/hosts/01/ipaddr 192.168.0.1', >>> 'set /chroot/httpd/files/etc/hosts/01/canonical >>> pigiron.example.com', >>> 'set /chroot/httpd/files/etc/hosts/01/alias[1] pigiron', >>> 'set /chroot/httpd/files/etc/hosts/01/alias[2] piggy', >>> ], >>> #onlyif => "match *[.='${title}']"; >>> } >>> >>> } >>> >>> >>> >>> On Monday, 27 June 2016 20:24:13 UTC+5:30, David Lutterkort wrote: >>>> >>>> On Friday, June 24, 2016 at 3:29:25 PM UTC+2, Shrawan Bhagwat wrote: >>>>> >>>>> Hi All, >>>>> >>>>> I have installed Augeas setup from yum repository using command yum >>>>> install ruby-augeas.x86_64. >>>>> >>>>> I have got all packages of Augeas but not able to find command Augtool. >>>>> >>>>> Please help! >>>>> >>>> >>>> If you are using the puppet-agent package from http://yum.puppet.com/, >>>> augtool (and augparse) are installed into /opt/puppetlabs/puppet/bin >>>> >>>> If you are not using the puppet-agent package, run 'yum install >>>> augeas'. That works for Fedora; for RHEL/CentOS, augtool is not in the >>>> base >>>> distro, and you have to first enable EPEL before running that yum command >>>> >>>> David >>>> >>> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Puppet Users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/puppet-users/mFjKO2V3-ig/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> puppet-users...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/puppet-users/40e72669-17d2-43ca-a473-8e2918d2a001%40googlegroups.com >> >> <https://groups.google.com/d/msgid/puppet-users/40e72669-17d2-43ca-a473-8e2918d2a001%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/e7558fae-26d6-4ce1-b774-88a802fc8f59%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.