[英]installing chef client using jclouds-chef on rackspace
我在嘗試使一切自動化時遇到問題。 我試圖在機架空間上創建一些全新的服務器
Q1。 如何在不進行交互的情況下在節點1上遠程配置刀具工具。 有什么辦法可以使用jclouds嗎?
Q2。 我如何獲得client.pem文件和驗證。 當我嘗試使用上述示例通過Chef客戶端配置節點時,pem文件在本地計算機上不可用。
Q3。 我如何使用腳本創建client.pem或遠程創建它?
任何幫助將不勝感激。
這里最棘手的部分是安裝Chef Server。 Chef API沒有提供一種獲取客戶端私鑰的方法。 它允許您重新生成和下載它,但是在第一個實例中,您需要具有一個有效的API才能執行對該API的調用。
最簡單的方法是在本地生成密鑰對,然后使用它來在Chef Server中配置客戶端和驗證器,並使用它們來配置客戶端節點。 通過將私鑰存儲在內部Chef Server數據庫中(使用Postgres),這涉及到一個棘手的步驟,但這對我來說很好。
這可能是一個腳本,用於安裝和配置Chef Server,並用已知的腳本覆蓋默認客戶端和驗證器的密鑰。
首先,在本地生成密鑰對。 這可以通過編程或使用以下命令來完成:
# Generate the keys for the client and the validator
ssh-keygen -t rsa -N "" -f client.pem # This creates the client.pem and client.pem.pub
ssh-keygen -t rsa -N "" -f validator.pem # This creates the validator.pem and validator.pem.pub
生成密鑰后,您可以使用以下腳本來安裝和配置Chef Server。
# Install the Chef Server (assumes an Ubuntu operating system)
# You can get the URLs for other operating systems at http://www.getchef.com
wget https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chef-server_11.0.11-1.ubuntu.12.04_amd64.deb
dpkg -i chef-server_11.0.11-1.ubuntu.12.04_amd64.deb
chef-server-ctl reconfigure
# Install the client public keys in the database
CLIENTKEY=`cat client.pem.pub`
VALIDATORKEY=`cat validator.pem.pub`
/opt/chef-server/embedded/bin/psql -U opscode_chef -c "update clients set public_key = \"$CLIENTKEY\" where name = 'chef-validator'"
/opt/chef-server/embedded/bin/psql -U opscode_chef -c "update clients set public_key = \"$VALIDATORKEY\" where name = 'chef-webui'"
# Override the default keys with the auto-generated ones
cp -f client.pem /etc/chef-server/chef-webui.pem
cp -f validator.pem /etc/chef-server/chef-validator.pem
此時,您將安裝Chef Server,並使用生成的密鑰配置默認客戶端。
擁有這些腳本將幫助您進行引導過程。 您可能必須先將生成的密鑰上載到該節點。 您可以使用ssh客戶端執行此操作,如jclouds計算指南中所示 。
在配置了Chef服務器的節點之后,使用jclouds-chef即可輕松配置客戶端節點。 您可以按照Chef指南或此堆棧溢出問題中描述的過程進行操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.