1

Using puppet, trying with the host resource to update /etc/hosts on node2.example.com with the below entry

     master.example.com  10.134.39.245
     node2.example.com   10.134.39.246

For this I have created the following manifest .

 node 'node2.example.com'{
 host{
    'master.example.com': ip => '10.134.39.245';
    'node2.example.com': ip => '10.134.39.246';
   }
  }

But /etc/hosts is not getting edited on node2.example.com

1 Answer 1

1

Each host should be a separate definition. And I'm not sure about the semicolons in your snippet. Also providing aliases for your hosts is a better practice.

Maybe you could try this syntax :

node 'node2.example.com' {
  host { 'master.example.com': 
    ip => '10.134.39.245',
    host_aliases => 'master',
  }
  host { 'node2.example.com': 
    ip => '10.134.39.246',
    host_aliases => 'node2',
  }
}

Puppet CookBook : Add a host entry

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .