Augeas-1.5.0 to edit file using Puppet

40 views
Skip to first unread message

Shrawan Bhagwat

unread,
Mar 30, 2017, 3:55:33 AM3/30/17
to Puppet Users
Hi All,

I have configured Puppet 3.8.1 and Augeas 1.5.0.

I am trying to edit /etc/hosts file using augeas with following code:

augeas{'host_file':
                context => "/files/etc/hosts",
                changes => [
          "set ipaddr 192.168.0.1",
          "set canonical pigiron.example.com",
          "set alias[1] pigiron",
          "set alias[2] piggy",
    ],
}

When i am applying this config on Node, it's giving following error:
Error: /Stage[main]/Aug_mod::Configuration_files/Augeas[host_file]: Could not evaluate: undefined method `set' for #<Augeas:0x7f941d460da8>

Please guide.


Peter Faller

unread,
Mar 30, 2017, 7:57:30 AM3/30/17
to Puppet Users
Is there any reason you're not using the built-in 'host' type? For example, this adds an entry to /etc/hosts:

  host {'north.xyz.com':
    ip => '192.168.100.2',
    host_aliases => [
      'north', 'main-switch'
    ],
  }


On Thursday, 30 March 2017 09:55:33 UTC+2, Shrawan Bhagwat wrote:

Shrawan Bhagwat

unread,
Apr 7, 2017, 12:57:35 AM4/7/17
to Puppet Users
Thanks Peter. It worked for me.

Shrawan Bhagwat

unread,
Apr 7, 2017, 2:10:06 AM4/7/17
to Puppet Users
Hi Peter,

Is commenting and uncommenting any line using Augeas is possible? if so, how?
Reply all
Reply to author
Forward
0 new messages