2014-10-02 1 views
0

요리사 노드를 만들기 위해 Vagrant를 사용 중이며 이미지를 회전시킨 다음 초기 chef-client 실행이 실패합니다. 내가 기계에 ssh 때 /etc/chef/client.pem을 삭제하고 sudo chef-client를 다시 실행하면 성공하지만 runr_list가 없으면 방랑에서 전달됩니다.요리사 노드에서 잘못된 client.pem을 생성 한 Vagrant (내 생각)

1) Vagrantfile은 상자 포장 :이 내 Vagrantfiles이

$ vagrant up 
Bringing machine 'default' up with 'vsphere' provider... 
==> default: Calling vSphere CloneVM with the following settings: 
==> default: -- Template VM: myOrg/vm/myFolder/vagrantchefnode 
==> default: -- Target VM: myOrg/vm/myFolder/test2 
==> default: Waiting for SSH to become available... 
==> default: New virtual machine successfully cloned and started 
==> default: Rsyncing folder: /home/user/.vagrant.d/boxes/test2/ => /vagrant 
==> default: Running provisioner: chef_client... 
==> default: Creating folder to hold client key... 
==> default: Uploading chef client validation key... 
Generating chef JSON and uploading... 
==> default: Running chef-client... 
==> default: stdin: is not a tty 
==> default: [2014-10-02T16:11:19-05:00] INFO: Forking chef instance to converge... 
==> default: [2014-10-02T16:11:19-05:00] INFO: *** Chef 11.16.2 *** 
==> default: [2014-10-02T16:11:19-05:00] INFO: Chef-client pid: 6080 
==> default: [2014-10-02T16:11:21-05:00] INFO: HTTP Request Returned 401 Unauthorized: error 

==> default: Failed to authenticate to the chef server (http 401). 

==> default: Failed to authenticate as 'test2'. Ensure that your node_name and client key are correct. 

==> default: chef_server_url "https://server.myorg.com" 
==> default: node_name   "test2" 
==> default: client_key  "/etc/chef/client.pem" 

:이 같은 실패는 모습입니다

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

Vagrant.configure("2") do |config| 
    config.vm.provider :vsphere do |vsphere| 
    vsphere.host = 'vsphereserver.myorg.com' 
    vsphere.compute_resource_name = 'TestDev' 
    vsphere.user = 'vagrantadmin' 
    vsphere.password = 'password' 
    vsphere.insecure = true 
    end 

    config.ssh.username = 'auto' 
    config.ssh.private_key_path = '~/.vagrant.d/id_rsa' 
end 

2) 내 집에 Vagrantfile 디렉토리 (~/.vagrant.d) :

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

Vagrant.configure("2") do |config| 
    config.vm.box = 'vsphere' 

    config.vm.provider :vsphere do |vsphere| 
    vsphere.template_name = 'vagrantchefnode' 
    end 

    config.vm.provision "chef_client", id: "chef" do |chef| 
    chef.provisioning_path = "/etc/chef" 
    chef.chef_server_url = "https://chefserver.myorg.com" 
    chef.validation_key_path = "/home/user/.vagrant.d/chef/validation.pem" 
# chef.client_key_path = "/etc/chef/client.pem" 
    chef.validation_client_name = "chef-validator" 
    chef.custom_config_path = "/home/user/.vagrant.d/Vagrantfile.chef" 
    chef.delete_node = true 
    chef.delete_client = true 
    chef.add_role "base" 
    end 
end 

3) Vagrantfile 프로젝트 디렉토리 (~/.vagrant.d/박스/chefnode1)에서 :

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

Vagrant.configure("2") do |config| 

    config.vm.provider :vsphere do |vsphere| 
# vsphere.template_name = 'chefnode' 
    vsphere.customization_spec_name = 'test2' 
    vsphere.name = 'test2' 
    end 

    config.vm.provision "chef_client", id: "chef" do |chef| 
    chef.node_name = "test2" 
    chef.add_role "dev" 
    end 
end 

내가 더 효과가 두 번째 Vagrantfile에서 chef.client_key_path을 밖으로 주석을 시도했습니다. 이것은 하나의 Vagrantfile에 모두 들어있을 때 잘 작동하는 것처럼 보였지만 모든 설정을 각 Vagrantfile에 복사하지 않고 여러 컴퓨터를 실행하려고합니다.

아무도 원한다면 --debug 태그가있는 전체 로그가 있습니다. 당신의 기본 이미지가 인증에 실패 장소에 이미 /etc/chef/client.pem 파일을 가지고 같은

답변

4

당신은

/etc/chef/client.pem

에가는 두 가지 문제가 소리가 난다. 새로운 노드/클라이언트가 처음 실행될 때 요리사와 함께 생성되도록 기본 이미지에서 이것을 제거해야합니다.

대체로 (하지만 제안하지는 않습니다.) 셰프 - 클라이언트 프로비저를 사용하기 전에 쉘 프로비저를 사용할 수 있습니다. 단점은 방랑자 제공에 대한 모든 요청이 chef-server로 클라이언트를 생성하려는 새로운 시도가된다는 것입니다. 새로운 요리사 노드가 생성 될 때 요리사 실행이 성공하면

빈 실행 목록은 실행 목록의 변경에 관해서는

는, 그것의 실행 목록에만 저장됩니다. 실패 했으므로 요리사 서버는 실행 목록을 저장하지 않았습니다. 그런 다음 직접 로그인하여 chef-client를 실행하면 서버에 실행 목록이 없는지 확인한 후 빈 실행 목록을 실행했습니다.

+0

빈 실행 목록은 실패했기 때문에 생각했습니다. 그러나 나는 이미베이스 이미지에서 client.pem을 삭제했다는 것을 알았습니다. 내일 인터넷 관리자가 다시 열어서 확인할 수 있도록 기다려야 할 것입니다. – Zook

+0

당신이 옳은 것 같아요, 나는 '부정한 업 - 노 - 프로비저닝'을 실행했고 실제로 컴퓨터에 '클라이언트 .pem'이 있습니다. 내일 해킹 할거야. – Zook