Hrmm - Maybe I am not being exactly clear. I originally started out trying to use puppet to not only configure my VMs, but provision them in the cloud as well. I started out with a template in cloudstack, and have been using cloudstack_resources to create new VMs automatically when my puppet manifest is applied.
Creating the VMs and all seems to work, however, I need a way to push specific configurations to specific boxes based on their role, so I was hoping to use the "role=whatever" userdata to be able to distinguish the different types of VMs that I have provisioned without having to have a bunch of node blocks to distinguish them by name. Maybe using cloudmonkey or some other tool is more effective, however I guess I was just trying to figure out how to use the supposedly already written puppet types to give me something out of the box that is "one command" provisioning and configuring. -Derek On Wed, Dec 4, 2013 at 2:56 PM, Hiroki Ohashi <silvernsh...@gmail.com>wrote: > Hi Derek > > When you use user-data, you have to provide user-data and deliver it > to virtual router. Unfortunately, CloudStack only provides REST API to > deliver user-data to virtual router now. This API is > deployVirtualMachine that creates instance and set instance specific > data. > > For example, I assume you want to deliver a shell script as user-data > below. > > ---------------------------------------------------------------------- > #! /bin/sh > > echo "Hello user-data!" > ---------------------------------------------------------------------- > > In this case, you can call deployVirtualMachine by CloudMonkey like > this. > > $ cloudmonkey deploy virtualmachine serviceofferingid=XXX > templateid=XXX zoneid=XXX networkids=XXX > userdata='IyEgL2Jpbi9zaAoKZWNobyAiSGVsbG8gdXNlci1kYXRhISIK' > > As a result of the command, a new instance is created with user-data > delivered to virtual router, so you can access user-data from the > instance. > > CloudMonkey is CLI tool to call CloudStack REST API easily and you can > give parameters as key value pair. In the example, user-data is base64 > encoded shell script and provied as a parameter. > > Best regards > Hiroki Ohashi > > 2013/12/5 Derek Cole <derek.c...@gmail.com>: > > I was kind of wondering about that, when I saw it earlier. It appears > that > > maybe the cloudstack_resources module has become out of date? I think you > > are the preparer of a slide-show I was following here: > > http://www.slideshare.net/PuppetLabs/cloudstack-18489665 > > > > It seems like in those slides, Group was being used to hold the roles? > This > > is why I assumed that was OK. I was doing something like > > > > case $::role { > > 'db': { > > notify {"detected a fact named role with value > db" > > :} > > } > > } > > because I thought that the custom fact here: > > > https://github.com/jasonhancock/puppet-facts/blob/master/cloudstack_userdata.rb > > > > Turned the cloudstack userdata into a fact where if you had > > "role=db,foo=bar" you would get two custom facts, role and foo, with > their > > respective values. > > > > May I ask for some clarity if that is not the intended usage? > > > > In my case, obviously cloudstack_userdata is not generating the correct > > facts, because the wget that is in that code returns nothing because > > userdata is empty. > > > > Thanks, > > > > -Derek > > > > > > > > On Wed, Dec 4, 2013 at 12:57 PM, David Nalley <da...@gnsa.us> wrote: > > > >> Hi Derek: > >> > >> Glad that the puppet resources are useful. > >> > >> Setting user-data is different than setting group: > >> > >> Look at the options here: > >> > >> > http://cloudstack.apache.org/docs/api/apidocs-4.2/user/deployVirtualMachine.html > >> > >> --David > >> > >> On Wed, Dec 4, 2013 at 11:54 AM, Derek Cole <derek.c...@gmail.com> > wrote: > >> > Hello, > >> > > >> > I am attempting to use the cloudstack API to get user-data for my VMs. > >> > > >> > I am creating the VMs with the puppet cloudstack-resources module, > and it > >> > seems to populate it (From the cloudstack GUI, under "Group" I see my > >> data) > >> > > >> > However, when I do a > >> > > >> > wget http://router/latest/user-data > >> > > >> > I get back an empty file. On the VR itself I have checked and there > are a > >> > bunch of /var/www/html/userdata/IP/user-data files, but every one of > them > >> > is empty. This same applies to VMs that I added the "Group" user data > >> > manually. > >> > > >> > The VM's are all FreeBSD10, and I am using xenserver 6.2, and > cloudstack > >> 4.2 > >> > > >> > Is this a bug? Is there a workaround or a fix? > >> > > >> > Thanks > >> > > > > -- > 大橋 宏樹 > mail: silvernsh...@gmail.com >