blob: a890272a82a38146dc7b966f81ffbb4e845b8c66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
##############################################################################
# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
mkdir -p /etc/chef
cat << EOL > /etc/chef/client.rb
log_level :info
log_location '/dev/null'
#if $getVar('chef_url', '') != ""
chef_server_url '$chef_url'
#elif $getVar("compass_server","") != ""
chef_server_url 'https://$compass_server'
#else
chef_server_url 'https://$server'
#end if
validation_client_name 'chef-validator'
json_attribs nil
pid_file '/var/run/chef-client.pid'
# Using default node name (fqdn)
no_lazy_load true
ssl_verify_mode :verify_none
#if $os_version == "rhel7"
verify_api_cert false
#end if
EOL
mkdir -p /etc/chef/trusted_certs
#set certs_path = $getVar("trusted_certs_path", "/var/opt/chef-server/nginx/ca")
#if $certs_path != ""
#import os
#import os.path
#set filenames = $os.listdir($certs_path)
#for filename in $filenames
#if $filename.endswith('.crt')
#set filepath = $os.path.join($certs_path, $filename)
#set f = $open($filepath)
cat << EOF > /etc/chef/trusted_certs/$filename
#echo $f.read()
EOF
#silent $f.close()
#end if
#end for
#end if
|