Keith Shannon
2014-May-21 15:29 UTC
[Puppet Users] First time using template... Is this correct?
Hello everyone and thank you for taking the time to ready this.
I have been creating my first puppet module for a chatserver we run. The
chatserver is basically just a perl script & its' not too hard to setup.
Our previous setup was with CFEngine so I'm porting everything over.
Setting the files in place was easy but we are moving from inittab to
Upstart (/etc/init instead of /etc/inittab).
Each server runs 7 instances of the chatserver on 7 different ports for 2
different sites.
Before I had two separate scripts that kept everything writing.
First chat_server_start.conf calls chat_server with the following:
start on runlevel [345]
task
script
start chat_server PORT="5000" SITE="ffadult"
start chat_server PORT="5001" SITE="ffadult"
start chat_server PORT="5002" SITE="ffadult"
start chat_server PORT="5003" SITE="ffadult"
start chat_server PORT="5004" SITE="ffadult"
start chat_server PORT="6600" SITE="getiton"
start chat_server PORT="6601" SITE="getiton"
end script
Then chat_server.conf runs...
# Respawn and start rules for chat_server.pl
stop on runlevel [06]
respawn
instance $PORT
exec /site/bin/chat/chat_server.pl $SITE $PORT >>
/var/log/chat_server/chat_server_${SITE}_${PORT}.log 2>&1
Simple enough... So here's where I'm unsure if I've done it right.
In my
git repo for puppet my modules is in /home/user/puppet/modules/chatserver
In files I have chat_server.conf & ffadult_chatserver_start.conf (we have
multiple clusters it's running on & it's called via a variable in
the other
file to call specific roles)
So now, I have created a template called chatserver_start.conf.erb and it
looks like the following:
start on runlevel [345]
task
script
<% @chats.each do |site_port| -%>
start chat_server PORT="<%= port %>" SITE="<%=
site %>"
<% end -%>
end script
I haven't put the contents of all related files here... So if you see are
wondering about something being called just let me know. I then put the
different port-site variations in hiera.
---
classes:
- ffn_logrotate::chat_server
- ffn_cron::cron_clean_chat_tmp
- ffn_cron::cron_chat_server_cleanup
- ffn::chatserver
- chatserver::chats:
ffadult: '5000'
ffadult: '5001'
ffadult: '5002'
ffadult: '5003'
ffadult: '5004'
getiton: '6000'
getiton: '6001'
Did I do this correctly? Any help would be appreciated. Even just pointing
to the proper documentation would be much appreciated. Our resident puppet
expert is out for the week and I'm trying to get this done before then.
Thanks again!
--
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 puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/e330f72e-6b8a-4548-a44d-c06a9ccbec1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.