Hi list!
In the light of my personal "Simon is dumping his problems on
others"-week I have a question regarding.. dunno.. generally "handling
of dynamic filecontent creation" I think is the best to describe it:
We use a lot of in-house built services (for arguments sake webservers)
which are instantiable and bring their own "framework" for setup, so I
created something like this:
#
define create-webservice ($ip =$ip, $servicename = $servicename,
$instance = $instance) {
exec {"create-webservice-script --ip $ip --instance $instance
--servicename $servicename$instance":
path => whatever,
alias => "create-webservice$servicename$instance"
}
}
#
Then I have n classes that use that definition:
#
class webserviceA_base {
$servicename = mywebservice
}
class webserviceA_01 {
create-webservice {"SomeService01":
ip => "99.99.99.99",
instance => "01"
}
}
class webserviceA_02 {
create-webservice {"SomeService02":
ip => "88.88.88.88",
instance => "02"
}
}
#
So far so good, works like a charm everyone is happy.
But this was just to give you the propper background to my actual
Problem. :/
We have a (once again) in-house build tool that sets up local
dummy-interfaces using a configfile containing something like
#
interfaces = "yy.yy.yy.yy xx.xx.xx.xx zz.zz.zz.zz"
#
which sets up a dummy-interface for each space-seperated ip-address
which are used for internal inter-service communication.
Creating that filecontent would be straigth forward IF you knew from the
start which services are on any given host, in that case I could simply
hardcode each service:
#
interfaces = "$webserviceA_01::ip $webserviceA_02::ip" and so on.
#
But this is not the case, there is and will be a lot of moving services
from one host to another and I simply hate the idea that the sysadmin
who is performing these moves or is setting up new services would every
time have to check each of the 20+ ips per host (and I´m talking about
at least 800 to 1000 Host that we want to manage with puppet that have
that kind of setup - not kidding! We use that kind of services setup not
only for webservers but for middleware as well and we have a whole f´ing
lot of that..) to check if he did indeed set that interface up (or
deleted it for that matter) that is going to be used by the new service.
I´d very much like to have this file created dynamicaly with the ips
that every of the aforementioned services use.
Is there any way to create an array dynamically or have each $ip
automatically integrated in that interfaces-file?
I thought about virtualizing that $ip variable and some how realizing it
in the interfaces-file and in the services class itself (ugly but
whatever) but this doesn´t work because I get an error along the lines
of "can´t reassing $ip in class 'dummy_interfaces' " as the
variable is
allways named the same..
I´m once again out of ideas how to do this and out of sleep to
regenerate mindpower, so please take a look at this, I´d appreciate your
help a lot!
Simon
_______________________________________________
Puppet-users mailing list
Puppet-users@madstop.com
https://mail.madstop.com/mailman/listinfo/puppet-users