how to puppet and diff without fqdn

asked 2014-07-10 03:29:06 -0600

ElvisMacak gravatar image

I have one problem, that how to manage the agent-nodes with puppet?

I'm using the openstack to auto generating the vms, and then puppet with several puppet-code in special pattern.

eg.

The system provision several vms, each vm has two attrs:

fqdn: maybe repeat(you know the vms are genrate by system in a complex env)

uuid: this will be unique, and is stored in a persistent file. it won't change

and below are two of them.

VM1:

fqdn: api-server.expamle.com
uuid: 20a558f1-2cd9-4068-b5fc-8d252c3f3262

VM2:

fqdn: api-server.expamle.com
uuid: 096359d6-5dc9-47e9-946a-bd702fe7c2d5

(Also, I can specify the hostname with the uuid, but I think it's not a good idea.)

and now I want to puppet them with puppet kick or mcollective puppet runonce.

with mco, i can choose the facter uuid, that will diff VM1&VM2.

mco pupppetd runonce --with-facter uuid=20a558f1-2cd9-4068-b5fc-8d252c3f3262

but I STILL MUST hardcode the fqdn in the puppet-code

node api-server.expamle.com {
    ...
}

but in fact, I just want use it in the following style:

facter 20a558f1-2cd9-4068-b5fc-8d252c3f3262 {
    ...
}
facter 096359d6-5dc9-47e9-946a-bd702fe7c2d5 {
    ...
}

how can I write the puppet? or do some change in the architecture?

edit retag flag offensive close merge delete