how to puppet and diff without fqdn

58 views
Skip to first unread message

el...@lnmpy.com

unread,
Jul 10, 2014, 4:34:39 AM7/10/14
to puppet...@googlegroups.com
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: 
    uuid: 20a558f1-2cd9-4068-b5fc-8d252c3f3262

VM2: 
    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
`
...
}
`

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?

Christopher Wood

unread,
Jul 10, 2014, 9:44:16 AM7/10/14
to puppet...@googlegroups.com
I confess I might not understand the question as phrased. It seems like you want to declare nodes by uuid not hostname. If so, you might want to set their certname to that uuid:

http://docs.puppetlabs.com/references/latest/configuration.html#certname

As part of the provisioning step you'd probably put the uuid in an external fact and build a stub puppet.conf. Later in the agent run you might use this custom fact to build a more complete puppet.conf for your agent.

http://docs.puppetlabs.com/guides/custom_facts.html#external-facts
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [1]puppet-users...@googlegroups.com.
> To view this discussion on the web visit
> [2]https://groups.google.com/d/msgid/puppet-users/e9abec5b-ea35-4eff-b6c5-bf1b27236e96%40googlegroups.com.
> For more options, visit [3]https://groups.google.com/d/optout.
>
> References
>
> Visible links
> 1. mailto:puppet-users...@googlegroups.com
> 2. https://groups.google.com/d/msgid/puppet-users/e9abec5b-ea35-4eff-b6c5-bf1b27236e96%40googlegroups.com?utm_medium=email&utm_source=footer
> 3. https://groups.google.com/d/optout

R.I.Pienaar

unread,
Jul 10, 2014, 9:49:20 AM7/10/14
to puppet...@googlegroups.com


----- Original Message -----
> From: "Christopher Wood" <christop...@pobox.com>
> To: puppet...@googlegroups.com
> Sent: Thursday, July 10, 2014 2:44:00 PM
> Subject: Re: [Puppet Users] how to puppet and diff without fqdn
>
> I confess I might not understand the question as phrased. It seems like you
> want to declare nodes by uuid not hostname. If so, you might want to set
> their certname to that uuid:
>
> http://docs.puppetlabs.com/references/latest/configuration.html#certname

you can set node_name_fact too, but this requires tweaking of the auth.conf iirc

el...@lnmpy.com

unread,
Jul 16, 2014, 2:44:39 AM7/16/14
to puppet...@googlegroups.com, christop...@pobox.com
thx, the certname works for me,  i have now replace the certname when the system starts 
thank you ~

在 2014年7月10日星期四UTC+8下午9时44分16秒,Christopher Wood写道:
Reply all
Reply to author
Forward
0 new messages