在 ubuntu chef 节点上使用 knife bootstrap 时出现错误

在 ubuntu chef 节点上使用 knife bootstrap 时出现错误

在 ubuntu chef 节点上获取 knife bootstrap 错误

$ knife bootstrap 52.8.178.221 -x ubuntu -i ~/Keys/chef1.pem

mkdir: cannot create directory ‘/etc/chef’: Permission denied
52.8.178.221 bash: line 35: /etc/chef/validation.pem: No such file or directory
52.8.178.221 chmod: cannot access ‘/etc/chef/validation.pem’: No such file or directory
52.8.178.221 mkdir: cannot create directory ‘/etc/chef’: Permission denied
52.8.178.221 bash: line 68: /etc/chef/trusted_certs/ashishk.crt: No such file or directory
52.8.178.221 bash: line 95: /etc/chef/client.rb: No such file or directory
52.8.178.221 bash: line 104: /etc/chef/first-boot.json: No such file or directory
52.8.178.221 Starting first Chef Client run...
52.8.178.221 bash: line 110: chef-client: command not found

chef-node 上的用户应该具有 sudo 权限,因此我添加了

# User privilege specification
root    ALL=(ALL:ALL) ALL
ubuntu  ALL=(ALL:ALL) ALL

仍然出现错误:

mkdir:无法创建目录‘/etc/chef’:权限被拒绝

答案1

得到了解决方案“--sudo --use-sudo-password”帮助完成了它!

$knife bootstrap  52.8.178.221 -x ubuntu -i ~/Keys/chef1.pem --sudo --use-sudo-password

相关内容