- From: Phil Mocek <
>
- To:
- Subject: [chef] Re: AWS CloudFormation Init and chef-client
- Date: Sat, 21 Mar 2015 15:32:44 -0700
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Michael Lindsay wrote:
>
what is the minimum required to have an [Amazon EC2] instance
>
spun up from an ami register and come under control of chef
>
server?
Such requirements for a virtual machine managed by AWS are no
different than those for any other physical or virtual machine.
Your question might be better asked as, "How does one [bootstrap
a node][1]?" or "How does one [bootstrap a node in an unattended
manner][2]?"
Assuming that you want the new machine to initiate contact with
the Chef server rather than having something on the Chef server
or another chef workstation connect to then new machine and start
the process, you'll need to have chef-client installed on the new
machine and for it to connect to and authenticate with a Chef
server, providing a run list and unique node name. There are
multiple ways to accomplish that.
I perform Chef bootstrapping of CloudFormation-launched EC2
instances by using a combination of [CloudInit][3] and the
[CloudFormation helper scripts][4] to create a file containing a
copy of the server's [chef-validator key][5], download and install
the applicable chef-client package, and initiate a chef-client
run. I trigger all of that upon first boot by providing [user
data][6] to the machine for CloudInit to read by defining it in
the [UserData section][7] of the Properties section of my
instance's definition in my stack template. For Ubuntu machines,
I use one of the Ubuntu-provided AMIs, which have CloudInit
installed. For CentOS, I make my own AMI, starting with a machine
launched from one of the CentOS maintainers' images, enabling the
EPEL repository, installing the cloud-init package, shutting down,
and imaging that machine.
Also, when asking a question on a technical mailing list, [putting
your question in the message subject][8] helps people know what
information you seek and thus makes it more likely that those who
can help will read the body of your message. It also helps other
people who have the same question find the answer later.
References:
[1]: <
https://docs.chef.io/install_bootstrap.html>
[2]: <
https://docs.chef.io/install_bootstrap.html#unattended-installs>
[3]: <
https://help.ubuntu.com/community/CloudInit>
[4]:
<
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-helper-scripts-reference.html>
[5]: <
https://docs.chef.io/chef_client.html#chef-validator>
[6]: <
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html>
[7]:
<
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-userdata>
[8]: <
http://catb.org/~esr/faqs/smart-questions.html#bespecific>
- --
Phil Mocek
https://mocek.org
-----BEGIN PGP SIGNATURE-----
iQIcBAEBCgAGBQJVDfGMAAoJECo3+Y/AS212pZwP/0WEYtpZgS4K8AtBqraI+tq2
7LdbGmZHsE1Cs5EkRLimGkSNcG/nAM4b0AdnlBqRtQnk5wyny19ayooY2iNmhsXn
9fLjy1q0HLqUwWNpaPahfscfmWcFLR5H3BqbPkcZMMG6SswITK4u/oiXAPORgx37
CPoc+lwt3JgvHo5B2xEcBW2q6NWwo1nxrdnLFWhvoO0aMSlHOEhpoz6BMdF7o/B2
khtbi8TuomjZtvyOp0zucm/uPv7tj3olB1jYrkESE6UaTZgZKq/Ei5AmBI3fXvcI
/dAqU1YSbinkBFECEfwuXC5jx8+duvkYIyeGxNMTvptP4JhYqkLkfb5EtmQn3iXk
V2pEADzBAdGdurmmTmDLoW+L2psi21sIyXJ8XAb/mKiOhbo/p/9q9QiVQ6GeUk6Z
+YrQIRoBc1zs6btYCO+7hKl7g3p1FHPVz1wUmoLXW7WYumPySdvz1e1jxowFJ47p
zRHUxqy72az0aFtgldqGaUoQvxJj7zbdRhrloFZRdf3u71soAv0ha/UcGmQtdcqW
baYqAjDGG3tlo8J0Z9Z5wCGBxfnHiLX1mmfUPbyrePky7fWuGt20fdA+4fDXwE+s
vCrf51+4pSwg980UtAEidV8IGoC9jRWR4KrMMp7OPZaeIUN1oUD1BgvFlDWXUwCI
hDpMKR14QQ96+eGNZOz3
=eTya
-----END PGP SIGNATURE-----
Archive powered by MHonArc 2.6.16.