Ask Your Question
0

Augeas-1.5.0 to edit file using Puppet

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

Shrawan gravatar image

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

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:

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.

edit retag flag offensive close merge delete

Comments

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. https://forge.puppet.com/ghoneycutt/hosts

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

1 Answer

Sort by ยป oldest newest most voted
0

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

DarylW gravatar image

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

I would probably use the host resource ( https://docs.puppet.com/puppet/latest... ) instead of augeas to manage hosts.

host { 'pigiron.example.com':
  ensure       => 'present',
  ip           => '192.168.0.1',
  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

Stats

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

Seen: 30 times

Last updated: Mar 31