Puppet Opensource: handling EC2 instances on AWS

148 views
Skip to first unread message

akash bhatia

unread,
Apr 14, 2015, 8:07:24 AM4/14/15
to puppet-users
Hello,

i have setup the Puppet Infra on internal datacentre at my work centre.

i am able to group the agents based on nomenclature of their domain names

eg: 
      web2.office.org ....

      db1.office.org....

and so on.. and i can group them in my site.pp using the regular expression.

i just want to understand the concept of how to achieve the same on the AWS, where we dont have liberty to customise domain name while creating a new instance in AWS EC2. 

Any URLs or basic idea should be highly appreciated.

Thanks in Advance !! 




--
Cheers,
Akash

Nick Howes

unread,
Apr 15, 2015, 7:06:05 AM4/15/15
to puppet...@googlegroups.com
You could set tags on EC2 instances, and use those to classify them. You might write a new fact called e.g. ec2_server_role, that reads in a tag from the server, then use that fact (possibly in the default node definition, depending on how you do things) to decide what role the node has.

Writing custom facts:

I'd recommend writing your fact in a module that Puppet can distribute by pluginsync, so you don't have to worry about pushing this custom fact script to nodes.

Alternatively there may well be existing modules on the Forge which can expose tags as facts for you.

Gareth Rushgrove

unread,
Apr 16, 2015, 11:49:22 AM4/16/15
to puppet...@googlegroups.com
On 15 April 2015 at 12:06, Nick Howes <nick...@gmail.com> wrote:
> You could set tags on EC2 instances, and use those to classify them. You
> might write a new fact called e.g. ec2_server_role, that reads in a tag from
> the server, then use that fact (possibly in the default node definition,
> depending on how you do things) to decide what role the node has.
>
> Writing custom facts:
> https://docs.puppetlabs.com/facter/2.4/custom_facts.html
>
> I'd recommend writing your fact in a module that Puppet can distribute by
> pluginsync, so you don't have to worry about pushing this custom fact script
> to nodes.
>
> Alternatively there may well be existing modules on the Forge which can
> expose tags as facts for you.
>

This module exposes EC2 tags to facter.

https://github.com/mrzarquon/puppet-ec2tags

Gareth

>
> On Tuesday, 14 April 2015 13:07:24 UTC+1, akash bhatia wrote:
>>
>> Hello,
>>
>> i have setup the Puppet Infra on internal datacentre at my work centre.
>>
>> i am able to group the agents based on nomenclature of their domain names
>>
>> eg:
>> web1.office.org
>> web2.office.org ....
>>
>> db1.office.org....
>>
>> and so on.. and i can group them in my site.pp using the regular
>> expression.
>>
>> i just want to understand the concept of how to achieve the same on the
>> AWS, where we dont have liberty to customise domain name while creating a
>> new instance in AWS EC2.
>>
>> Any URLs or basic idea should be highly appreciated.
>>
>> Thanks in Advance !!
>>
>>
>>
>>
>> --
>> Cheers,
>> Akash
>
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/606cb1b8-de5d-43fe-b40b-a1675289fe93%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Gareth Rushgrove
@garethr

devopsweekly.com
morethanseven.net
garethrushgrove.com

Martijn

unread,
Apr 21, 2015, 7:52:15 PM4/21/15
to puppet...@googlegroups.com
Op dinsdag 14 april 2015 14:07:24 UTC+2 schreef akash bhatia:

i just want to understand the concept of how to achieve the same on the AWS, where we dont have liberty to customise domain name while creating a new instance in AWS EC2. 


It is possible to set your own custom domain name on AWS VPC (not on EC2) via DHCP Option Sets. See http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_DHCP_Options.html.

Also you have the option of providing 'cloud-config' user-data to the instance at creation time, if your distro supports the cloud-init system. Most modern distros support this, on EC2 and VPC. For example:

#cloud-config
hostname: mynode
manage_etc_hosts: true

I agree with the other replies though, that it's probably better to rely on facts/tags to specify roles than on hostnames or certnames. We're guilty of the latter though, encoding the role into the node's certname and using that in site.pp to select nodes. We use cloud-init to set the certname via user-data during node creation and automatically connect to our puppet master. Similar to this: http://cloudinit.readthedocs.org/en/latest/topics/examples.html#setup-and-run-puppet. It works, but we're moving toward the tags method.

Reply all
Reply to author
Forward
0 new messages