summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2021-03-23 17:15:54 -0700
committerGitHub <noreply@github.com>2021-03-23 17:15:54 -0700
commitcfb1cf0ca55549131704ea7784eb4aab63e9f7cd (patch)
tree2e39766df647642bf4ec97c50f5fdf90b0f13dec
parent80b644550ceb7e88c2f13a33e316826df4b3e591 (diff)
parent93cf64a6afabb803e290eb65e248a9ceac2308c6 (diff)
downloadchef-cfb1cf0ca55549131704ea7784eb4aab63e9f7cd.tar.gz
Merge pull request #11173 from chef/sample_config
Signed-off-by: Tim Smith <tsmith@chef.io>
-rwxr-xr-xomnibus/package-scripts/chef/postinst22
1 files changed, 18 insertions, 4 deletions
diff --git a/omnibus/package-scripts/chef/postinst b/omnibus/package-scripts/chef/postinst
index fa41f83ab4..61d1d0abe1 100755
--- a/omnibus/package-scripts/chef/postinst
+++ b/omnibus/package-scripts/chef/postinst
@@ -94,10 +94,24 @@ ln -sf $INSTALLER_DIR/bin/ohai $PREFIX/bin || error_exit "Cannot link ohai to $P
ln -sf $INSTALLER_DIR/bin/chef-client $PREFIX/bin || error_exit "Cannot link chef-client to $PREFIX/bin"
# make the base structure for chef to run
-mkdir -p /etc/chef/client.d/
-mkdir -p /etc/chef/accepted_licenses
-mkdir -p /etc/chef/trusted_certs
-mkdir -p /etc/chef/ohai/plugins
+# the sample client.rb is only written out of no chef config dir exists yet
+if ! [ -d $CONFIG_DIR ]; then
+ mkdir -p $CONFIG_DIR
+ cat >"$CONFIG_DIR/client.rb" <<EOF
+# The client.rb file specifies how Chef Infra Client is configured on a node
+# See https://docs.chef.io/config_rb_client/ for detailed configuration options
+#
+# Minimal example configuration:
+# node_name "THIS_NODE_NAME"
+# chef_server_url "https://CHEF.MYCOMPANY.COM/organizations/MY_CHEF_ORG"
+# chef_license "accept"
+EOF
+fi
+
+mkdir -p "$CONFIG_DIR/client.d"
+mkdir -p "$CONFIG_DIR/accepted_licenses"
+mkdir -p "$CONFIG_DIR/trusted_certs"
+mkdir -p "$CONFIG_DIR/ohai/plugins"
echo "Thank you for installing Chef Infra Client! For help getting started visit https://learn.chef.io"