自動化運維工具安裝部署 chef (四) - node的安裝
https://docs.chef.io/nodes.html
節點分好幾種
又加了一臺機器
[root@chefnode ~]# cat /etc/hosts先確保hosts裏面都有解析
[root@chefserver chef]# scp chefdk-2.4.17-1.el7.x86_64.rpm root@chefnode:/root/chef
先安裝DK
rpm –ivh chefdk-2.4.17-1.el7.x86_64.rpm?
安裝之後驗證下
echo ‘eval "$(chef shell-init bash)"‘ >> ~/.bash_profile
. ~/.bash_profile
which ruby
修正時區
cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ntpdate time.windows.com
添加節點搞了很久
knife bootstrap 192.168.209.134 --ssh-user root--ssh-password --node-name chefnode
knife bootstrap root@chefworkstation -n chefnode
knife bootstrap root@chefworkstation --node-name chefnode
scp -pr root@chefserver:/usr/chef/pcdog.pem ~/chef-repo/.chef/
knife bootstrap 192.168.209.134 --ssh-user root --ssh-password redhat --node-name node1
knife bootstrap 192.168.209.134 --ssh-user root --node-name chefnode
knife bootstrap <server_address> -x <server_username> -N <name_for_the_client> -i <ssh_certificate> --sudo
knife bootstrap 192.168.209.134 -x root -N chefnode --sudo
還是有錯
看下錯誤日誌
cat /var/chef/cache/chef-stacktrace.out
看不出個所以然
一直都是knife配置問題,只能嘗試重新初始化knife
knife configure initial
Unexpected Error:
-----------------
OpenSSL::SSL::SSLError: SSL Error connecting to https://chefserver/organizations/it/nodes/chefnode - SSL_connect returned=1 errno=0 state=error: certificate verify failed
node一直無法註冊上server,想想可能安全問題比較大,把chefnode的selinux關閉下嘗試下
vi /etc/selinux/config
然後重啟
還是老錯誤
Response: Invalid signature for user or client ‘pcdog‘
去了google的group,發現一個有用的命令,居然可以debug輸出
chef-client -l debug
最後還是SSL證書錯誤
嘗試重新生成validation key並且上傳
校驗證書應該沒問題,應該是pem文件問題,
[root@chefnode /]# knife node list
ERROR: Failed to authenticate to https://chefserver/organizations/it as chefnode with key /root/.chef/pcdog.pem
Response: Failed to authenticate as ‘chefnode‘. Ensure that your node_name and client key are correct.
可能我用錯了企業證書
容我再次回到學習中心進行回爐
https://learn.chef.io/modules/manage-a-node-chef-server/rhel/bring-your-own-system/get-a-node-to-bootstrap#/
再次更新小刀
[root@chefnode .chef]# vi knife.rb
node_name ‘chefnode‘
client_key ‘/root/.chef/it-validator.pem‘
validation_client_name ‘it-validator‘
validation_key ‘/etc/chef-server/it-validator.pem‘
chef_server_url ‘https://chefserver/organizations/it‘
syntax_check_cache_path ‘/root/.chef/syntax_check_cache‘
cookbook_path [ ‘/root/chef-repo/cookbooks‘ ]
唯一的可能就是節點名字和key不一致,我沒有key,我不是商業用戶,拿不到正式license
[root@chefnode /]# knife node list
ERROR: Failed to authenticate to https://chefserver/organizations/it as chefnode with key /root/.chef/it-validator.pem
Response: Failed to authenticate as ‘chefnode‘. Ensure that your node_name and client key are correct.
[root@chefnode /]#
自動化運維工具安裝部署 chef (四) - node的安裝