Augtool installation

442 views
Skip to first unread message

Shrawan Bhagwat

unread,
Jun 24, 2016, 9:29:25 AM6/24/16
to Puppet Users
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!

Regards,
Shrawan

Michael Watters

unread,
Jun 24, 2016, 2:36:24 PM6/24/16
to Puppet Users
You'll need to install the package that provides augtool in order to use it.

yum provides augtool should show you what package to install.

Shrawan Bhagwat

unread,
Jun 27, 2016, 6:51:59 AM6/27/16
to Puppet Users
Hi Michael,

 i have tried install it from yum, but it's not available over there.

Then as per the download documentation available, i have downloaded tar from  http://download.augeas.net/ .

But still i havent got augtool.

Please help.

Regards,
Shrawan

David Lutterkort

unread,
Jun 27, 2016, 10:54:13 AM6/27/16
to Puppet Users

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

Shrawan Bhagwat

unread,
Jun 28, 2016, 2:31:06 AM6/28/16
to Puppet Users
Hi David,

Thanks for your response.


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}']";
}

}

Shrawan Bhagwat

unread,
Jun 28, 2016, 2:51:46 AM6/28/16
to Puppet Users
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>

while the same is working fine with augtool on command line.

Please help.

Regards,
Shrawan

David Lutterkort

unread,
Jun 29, 2016, 8:31:30 AM6/29/16
to puppet...@googlegroups.com
Hi Shrawan,

On Tue, Jun 28, 2016 at 8:51 AM, Shrawan Bhagwat <shraw...@gmail.com> 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

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

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/40e72669-17d2-43ca-a473-8e2918d2a001%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Shrawan Bhagwat

unread,
Jul 1, 2016, 10:06:47 AM7/1/16
to Puppet Users
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

Shrawan Bhagwat

unread,
Jul 12, 2016, 5:37:54 AM7/12/16
to Puppet Users
Hi David,

Waiting for you response. :)

Regards,
Shrawan

jiminfote...@gmail.com

unread,
Jul 12, 2016, 11:11:29 AM7/12/16
to Puppet Users
Hi Shrawan,

How about you remove 1.0.0 version completely and install 1.5.0. You can uninstall any package in redhat/centos by yum remove<software/package name>

I'm hoping that this is not a production neither development but your own VM ! :)

Cheers,
Jim
Reply all
Reply to author
Forward
0 new messages