Skip to content

Instantly share code, notes, and snippets.

@sjourdan
Created April 13, 2015 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjourdan/d68a3fa6169e49116596 to your computer and use it in GitHub Desktop.
Save sjourdan/d68a3fa6169e49116596 to your computer and use it in GitHub Desktop.
cloud-init with Chef provisionning + register
#cloud-config
users:
- name: demo
sudo: ['ALL=(ALL) NOPASSWD:ALL']
groups: sudo
shell: /bin/bash
chef:
install_type: "omnibus"
omnibus_url: "https://www.opscode.com/chef/install.sh"
force_install: false
server_url: "https://api.opscode.com/organizations/cloudinit"
node_name: "cloudinit-lala"
validation_name: "cloudinit-validator"
validation_key: |
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAqAKSmwTJonSpYZfjkIHMCypK1adiawYyM9et/sFnp7csXwiu
...
-----END RSA PRIVATE KEY-----
output: {all: '| tee -a /var/log/cloud-init-output.log'}
runcmd:
- while [ ! -e /usr/bin/chef-client ]; do sleep 5; done; chef-client
disable_ec2_metadata: true
@narendramannam
Copy link

narendramannam commented Oct 27, 2016

Looks great to get started, I've a question here. How do you configure/ pass unique name to the node_name when you are spinning multiple instances of same type. Especially in clustered environments.

@tpmullan
Copy link

tpmullan commented Jan 11, 2017

Here is an example of unique names for the node_name

 # Node Name
 # Defaults to the instance-id if not present
 node_name: "#{Socket.gethostname}-test"

@imewish
Copy link

imewish commented May 4, 2017

Hello,

Is there any way that i can choose specific version of the chef?

@gliptak
Copy link

gliptak commented Jun 26, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment