2017-11-08 9 views
0

사용자 지정 템플릿을 사용하여 부트 스트랩을 시도하고 있습니다. 여기에 제가 사용하는 부트 스트랩 명령이 있습니다validation.pem에 개인 키 대신 false가 포함되어 있음

knife bootstrap 1.2.3.4 -t D:\chef-starter\chef-repo\.chef\bootstrap\chefbootstrap-linux.erb -x root -P XXXX -N chefclientrhel -r "recipe[starter]" -j '{"bootstrap_directory":"/etc/chef/prod/prov","chef_client_package":"/tmp/chef-13.6.4-1.el7.x86_64.rpm","instance_id":"12345-678910"}' 

그리고 여기에 관련 코드가있는 템플릿이 있습니다. 이 문제와 관련없는 일부 코드가 있으므로 건너 뜁니다.

bash -c ' 
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%> 

<%# Get bootstrap command-line attributes (from -j flag) -%> 
<% if @config[:first_boot_attributes]['chef_client_package'] -%> 
chef_client_rpm="<%= @config[:first_boot_attributes]['chef_client_package'] %>" 
<% else -%> 
chef_client_rpm="/etc/chef/chef-11.12.4-1.el6.x86_64.rpm" 
<% end -%> 

<% if @config[:first_boot_attributes]['bootstrap_directory'] -%> 
<% bootstrap_directory = @config[:first_boot_attributes]['bootstrap_directory'] -%> 
<% else -%> 
<% bootstrap_directory = "/etc/chef/chefdefault" -%> 
<% end -%> 
bootstrap_directory=<%= bootstrap_directory %>    

awk NF > <%= bootstrap_directory %>/validation.pem <<'EOP' 
<%= validation_key %> 
EOP 
chmod 0600 <%= bootstrap_directory %>/validation.pem 

<% if @chef_config[:encrypted_data_bag_secret] -%> 
awk NF > <%= bootstrap_directory %>/encrypted_data_bag_secret <<'EOP' 
<%= encrypted_data_bag_secret %> 
EOP 
chmod 0600 <%= bootstrap_directory %>/encrypted_data_bag_secret 
<% end -%> 

<% # Find the trusted_certs directory relative to the directory containing 
# the config_file (knife.rb). Use the first *.crt file from that directory. -%> 
<% cert_path = Dir[File.dirname(@config[:config_file]) + "/trusted_certs/*.crt"][0] -%> 
<% cert_file = cert_path[cert_path.rindex('/')+1..-1] -%> 
echo Writing server cert file <%= cert_file %> to trusted_certs... 
mkdir -p <%= bootstrap_directory %>/trusted_certs 
cat > <%= bootstrap_directory %>/trusted_certs/<%= cert_file %> <<'EOP' 
<%= ::File.read(cert_path) %> 
EOP 
echo Server cert file written. 

<% #customize client.rb file, e.g. specify log file and level etc, replace original input for var config_content -%> 
<% 
client_rb = config_content 
client_rb.gsub!(':auto',':info') 
client_rb.gsub!("/etc/chef" ,bootstrap_directory + "/") 

puts client_rb 
-%> 

cat > <%= bootstrap_directory %>/client.rb <<'EOP' 
<%= client_rb %> 
ssl_verify_mode :verify_peer 
log_level :info 
<%= "client_key \"" + bootstrap_directory + "/client.pem\"" %> 
<%= "validation_key \"" + bootstrap_directory + "/validation1.pem\"" %> 
<%= "http_retry_count 5" %> 
<%= "http_retry_delay 5" %>   
<%= "rest_timeout 300" %> 

<%= "require \"" + bootstrap_directory + "/SuccessReport.rb\"" %> 
<%= "require \"" + bootstrap_directory + "/FailureReport.rb\"" %> 
<%= "report_handlers << SuccessReport::RunningResults.new" %> 
<%= "exception_handlers << FailureReport::RunningResults.new" %> 
EOP 

<% # Double any backslashes to solve Linux-only problem where half are getting lost on way to first-boot.json -%> 
cat > <%= bootstrap_directory %>/first-boot.json <<'EOP' 
<%= first_boot.to_json.gsub('$','\$').gsub('\\', '\\\\\\\\') %> 
EOP 

<% # customize to sub out the old bootstrap directory -%> 
<% 
new_start_chef = "/usr/bin/sudo -n " + start_chef 
new_start_chef.gsub!("/etc/chef/" ,bootstrap_directory + "/") 
new_start_chef.gsub!("-j" , "-c " +bootstrap_directory + "/client.rb -j") 
-%> 
echo <%= new_start_chef %> 
<%= new_start_chef %>' 

나는 그것에서 false있다 validation.pem 열 때 나는

ERROR: The file /etc/chef/prod/prov/validation.pem or :raw_key option does not contain a correctly formatted private key. 

부트 스트랩 때 다음과 같은 오류를 얻을 때마다. 그게 다야. 나는 이것이 왜 그렇게 중요한지 잘 모르겠습니다. 내 요리사 서버에서 나는 요리사 서버의/etc가/요리사 디렉토리 내-validator.pem 파일을 cpoying 및 validation.pem하기 위해 이름을 변경했지만 여전히 복사되지 시도

chef-server-ctl org-create my 'For customer my' --association_user user1 --filename my-validator.pem 

다음 명령을 사용하여 조직을 만들었다 클라이언트의 올바른 유효성 검사 파일 왜 그런가?

답변

0

나는 문제를 파악했다. 문제는 knife.rb도 아니고 bootstrap 명령에 validation_key도 없었습니다. knife.rb에 validation_key를 추가 한 후 노드에 validation.pem 파일이 올바르게 있습니다. 부트 스트랩하는 동안 나는 아직도 401 오류를 얻고있다.