Exported resources where two hosts have the same name in masterless puppet [closed]

asked 2016-12-22 10:03:34 -0600

davideagle gravatar image

I'm managing /etc/hosts in openstack projects using puppet in a masterless setup using exported resources as seen below, where I use tag = openstackprojectid where the ID is a unique id of an openstack project/tennant. But the problem is when I have hosts with the same name in two different projects I run into some kind of a race condition, where hosts start to disappear randomly from /etc/hosts, I'd think the tag would prevent this but I'm not too familiar with how stored configs work in PupptDB.

Any suggestions how I could fix this, since I do not have the luxury of ensuring unique hostnames

if $::openstackprojectid { resources { 'host': purge => true, }

@@host { "${::openstack_project_id}-${::fqdn}":
  name         => $::fqdn,
  ensure       => present,
  ip           => $::ipaddress,
  host_aliases => $::hostname,
  tag          => $::openstack_project_id,

Host <<| tag == $::openstack_project_id |>>

} else { warning('openstackprojectid fact must be set') }

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by Kai Burghardt
close date 2016-12-22 17:53:54.051699