So here's an interesting predicament.......
As I continue to make our Vagrantfile more dynamic and scalable, I'm
running into a slight issue regarding chef.json. The old Vagrantfile has
individual nodes declared and associated chef.json entries with a code
block like:
chef.json = {
:rabbitmq => {
:port => 5000,
:cluster_disk_nodes =>
["rabbit@#{hostname(COMPONENTS[:app_mq1])}"],
}
}
Both the hostname method as well as the COMPONENTS hash exist in the the
old Vagrantfile and my working copy. The problem is, I've changed the
Vagrantfile so the chef.json data is populated from a remote file like so:
if !node[:chef_json].empty?
dna = JSON.parse(File.read("./chef_json/#{node[:chef_json]}"))
chef.json.merge!(dna)
end
Each node (VM) has an key/value pairing to a file (ie: web.json or
app-mq1.json). With that being said, these .json files are written out like
how they were inline, but when Chef provisions, the Ruby variable is not
being interpolated and therefore, I end up with a RabbitMQ config file like
so:
vagrant@dev-app-mq1:$ sudo cat /etc/rabbitmq/rabbitmq-env.conf
###
# Generated by Chef
###
*NODENAME=rabbit@#{hostname(COMPONENTS[:app_mq1])}*
NODE_PORT=5000
CONFIG_FILE=/etc/rabbitmq/rabbitmq
MNESIA_BASE=/var/lib/rabbitmq/mnesia
Does anyone have any guidance on how to get this to work as I intend? The
other workaround would be to put things back inline, but then I've lost
some progress on optimization, etc.
Thanks,
Brendan
--
You received this message because you are subscribed to the Google Groups
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.