Ask Your Question
0

Deploying EC2 instances using different configuration files and puppet

asked 2015-08-28 14:19:41 -0500

r4hul gravatar image

updated 2015-09-09 17:00:16 -0500

What I wanna do is deploy AWS resources (EC2 mostly) on the basis of different configuration files I have - web.yaml, app.yaml, db.yaml - depending on what type of server I want to configure. Here is a use case:

I need the following servers deployed:

1 web server -- puppet must pick config from web.yaml

1 app server -- puppet must pick config from app.yaml

1 db server -- puppet must pick config from db.yaml

I have a puppet code that is using hiera() method calls to fill in each variable. And I have three different config files that must be called based on a parameter that I pass while executing the puppet code to deploy one of each server type.

I am pretty new to puppet and hiera and probably thinking out loud but any help or information would be appreciated...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-09-01 08:33:00 -0500

SimonH gravatar image

I'd suggest using the puppetlabs aws module from the forge - https://forge.puppetlabs.com/puppetla... and managing the configuration via hiera.

There's an example at https://github.com/puppetlabs/puppetl... which may help

edit flag offensive delete link more

Comments

Thanks for the response. Is there a way to call a particular YAML file in heira. Like if I have a dev and a prod YAML file and I want my puppet code (that launches one EC2 instance) to pick either of those files based on some parameter I give while invoking puppet apply command?

r4hul gravatar imager4hul ( 2015-09-01 11:32:00 -0500 )edit

hiera can be configured to supply parameters based on any of the facts available - for example, we use domain, servernames as parameters to specify our instances. For something like prod, test etc. it's probably worthwhile looking at the environment fact.

SimonH gravatar imageSimonH ( 2015-09-02 05:13:22 -0500 )edit

but that would be useful if I have a master-agent setup right? I have one master that I use to deploy new instances. I have updated the question to be a little more clear in my needs :)

r4hul gravatar imager4hul ( 2015-09-09 17:01:24 -0500 )edit
1

I'd look at setting a custom fact to define the type of server and then adding that to your hiera hierarchy definition and then naming the files according.

SimonH gravatar imageSimonH ( 2015-09-10 04:18:17 -0500 )edit

I don't think that would work. I only have a master puppet server and I can't set different custom facts for a single key "environment" to make it pick relevant file. In a way I can do but I'll have to change that fact every time I deploy something different. It is similar to changing hiera file.

r4hul gravatar imager4hul ( 2015-09-10 11:45:16 -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

Stats

Asked: 2015-08-28 14:19:41 -0500

Seen: 449 times

Last updated: Sep 09 '15