Ask Your Question

Augeas-1.5.0 to edit file using Puppet

asked 2017-03-30 06:25:19 -0600

Shrawan gravatar image

updated 2017-03-31 07:16:34 -0600

DarylW gravatar image

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:

                context => "/files/etc/hosts",
                changes => [
          "set ipaddr",
          "set canonical",
          "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.

edit retag flag offensive close merge delete


I don't have a solution as I am not an augeas guru but a simpler solution would be to implement the hosts module from the forge. It will create the entry and manage it for you.

puser gravatar imagepuser ( 2017-03-31 06:22:48 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-03-31 07:15:32 -0600

DarylW gravatar image

updated 2017-03-31 07:20:35 -0600

I would probably use the host resource ( ) instead of augeas to manage hosts.

host { '':
  ensure       => 'present',
  ip           => '',
  host_aliases => ['pigiron', 'piggy'],
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2017-03-30 06:25:19 -0600

Seen: 83 times

Last updated: Mar 31 '17