[chef] Re: "Just" register a Chef node ?


Chronological Thread 
  • From: "Tracy Phillips" < >
  • To:
  • Subject: [chef] Re: "Just" register a Chef node ?
  • Date: Mon, 13 Jul 2015 09:48:40 -0400

Hi Jim,

If you are talking about installing and registering a node during preseed (or 
kickstart if you use RHEL), this is what we do to install and register 
chef-clients:

/bin/mkdir /etc/chef

/usr/bin/curl -L https://www.chef.io/chef/install.sh ;| bash

cat <<EOF > /etc/chef/client.rb
log_level               :info
log_location            "/var/log/chef/client.log"
ssl_verify_mode         :verify_none
validation_client_name  "example-company-validator"
validation_key          "/etc/chef/validation.pem"
client_key              "/etc/chef/client.pem"
chef_server_url         
"https://chef.example.com/organizations/example-company";
environment             "$ENVIRONMENT"
node_name               "$NODENAME"
json_attribs            "/etc/chef/firstboot.json"
file_cache_path         "/var/cache/chef"
file_backup_path        "/var/backups/chef"
pid_file                "/var/run/chef/client.pid"
Chef::Log::Formatter.show_time = true
EOF

cat <<'EOF' > /etc/chef/validation.pem
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEArGnRgfBG5s74qw7eNCo15hZgq/SRm6cPBrsA7pTVkfpSII2g
mKYArDdcxZR0d85AiCHre+0rTn/tBkTijdHFWTLtBpONF2UmsYOpFk27tFZEpz7K
0Lm+h1u8doiKr0iyA7v9JO7pLGmcSEUV3ORE8OXuefs3/EaAwHlE2kLDZuBK/75k
9G34mLUbWLsJd9qfgaPi7gioJcRM/+UmIUIsoq+sFcIgEe2TmF0MtTbpGl3zT7Lg
7Lxc9ZdqN31Cwk7T/VeF3oGeE2pRp7dnVuTnMBnStZZbUXYZKxnciZp+jjaFtBCM
0SSM/B0CgYEA0zn4gVtrGet5vjAWpG7KK0mScULr8uvaogtxFHTcei18gzGKkBtc
hscDgh6kJwOAmArKglsi2woTkO9ToXxBO6CFDTgCRpNQGzppDIASZbSuTM+6/PL5
9lQ7383T8p3CyLOt08G1gYPYSWC28GnSL3WovvFCkip3LCSUAe4XqwcCgYEA0PWv
4KzTk6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RSA PRIVATE KEY-----
EOF

echo '{"run_list": ["role[bootstrap]"]}' > /etc/chef/firstboot.json

/bin/mkdir /var/log/chef

/usr/bin/chef-client -E "$ENVIRONMENT" -j /etc/chef/firstboot.json -L 
/var/log/chef/bootstrap.log


The $ENVIRONMENT & $NODENAME variable's are set during our preseed 
late_command scripts that we run "in-target".

Hope this helps.


--
Tracy Phillips

On Sunday, July 12, 2015 12:09 EDT, o haya 
< >
 wrote:

> Hi,
>
> Assuming the machine already:
>
> - Has the Chef client software installed
> - Has client.pem removed
> - Has client.rb with "node_name" being empty
>
> Does Chef provide a way/tool to remotely cause that machine to be 
> registered as a Chef node (initiated from a centralized machine)?
>
> This would be for both Windows-based and Linux (CENTOS-/Redhat-) based 
> machines.
>
> I know that we can do "knife bootstrap", but in our case, we don't want to 
> push the Chef client software to the node machines, but rather want to 
> pre-provision the node machines with the Chef client software and just be 
> able to cause the node machines to register as Chef nodes.  Something like 
> having a "knife bootstrap", but where the bootstrap process would not 
> include pushing the Chef client software to the node machine(s), would be 
> perfect.
>
> Thanks,
> Jim
>






Archive powered by MHonArc 2.6.16.

§