Ask Your Question

how to pass db node info to tomcat node?

asked 2014-06-06 10:01:38 -0500

mbekham77 gravatar image

I have installed a puppet master on one machine

I have installed puppet agents on two machines.

I would like to install tomcat module on one puppet agent machine and install mysql/postgresql on another puppet agent machine.

But, at the time installing tomcat module, i would like to pass mysql host/ip details to tomcat module so that when tomcat module is applied on the machine, the webapp can connect to mysql/postgresql machine with no manual changes.

How do we do that? I know it can be done by facter. But, documentation does not provide any indicators. Please give code sample

edit retag flag offensive close merge delete


basically, how to provide db puppet agent host/ip into context.xml file in tomcat installation. context.xml has a field called hostname that needs be assigned db host name detail

mbekham77 gravatar imagembekham77 ( 2014-06-06 10:02:55 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-06-06 10:36:34 -0500

Well i think you could do it with some mcollective stuff. But basicly i would prefere doing it via hiera data on the puppet master.

Something like this:

mysql::host: ''
mysql::user: 'root'
mysql::password: 'mypassword'

and then passing that onto the tomcat node.

At some level you have always a kind of configuration

edit flag offensive delete link more


But, how to get my sql node ip on fly. here its hardcoded. my mysql vm gets created on fly and puppet agent will be running on it. And my need is to get ip address of this node and replace with some kind of property variable as opposed to hardcoding as u specified

mbekham77 gravatar imagembekham77 ( 2014-06-06 20:04:51 -0500 )edit

How is your MySQL VM generated? You could make a facter module which queries your razor/foreman whatever installation to get the ip address. How ever the basic idea is: Somewhere you need to have a IP/Hostname of the Machines. You need to get there via facter/mcollective or ENC and get those informations.

Dennis Philpot gravatar imageDennis Philpot ( 2014-06-07 10:47:37 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-06-06 10:01:38 -0500

Seen: 63 times

Last updated: Jun 06 '14