summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2021-03-11 12:18:12 -0800
committerTim Smith <tsmith84@gmail.com>2021-03-23 12:07:21 -0700
commitd27c48f306acb31a78c89b8b0f275dea91ffc944 (patch)
tree8a51d53945d9d52c885c276a7033782b7c2e9663
parent82998552c5fcee69f85568710c18666876f26693 (diff)
downloadchef-d27c48f306acb31a78c89b8b0f275dea91ffc944.tar.gz
Drop off a sample client.rb config on Linux
Give the users enough of a directory structure and config that they can get started on their own. Also point them to the docs that tell them what all the config options are. Signed-off-by: Tim Smith <tsmith@chef.io>
-rwxr-xr-xomnibus/package-scripts/chef/postinst20
1 files changed, 16 insertions, 4 deletions
diff --git a/omnibus/package-scripts/chef/postinst b/omnibus/package-scripts/chef/postinst
index fa41f83ab4..ed6689e246 100755
--- a/omnibus/package-scripts/chef/postinst
+++ b/omnibus/package-scripts/chef/postinst
@@ -94,10 +94,22 @@ 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
+ echo -e "# The client.rb file specifies how Chef Infra Client is configured on a node" > "$CONFIG_DIR/client.rb"
+ echo -e "# See https://docs.chef.io/config_rb_client/ for detailed configuration options" >> "$CONFIG_DIR/client.rb"
+ echo -e "#" >> "$CONFIG_DIR/client.rb"
+ echo -e "# Minimal example configuration:" >> "$CONFIG_DIR/client.rb"
+ echo -e "# node_name \"THIS_NODE_NAME\"" >> "$CONFIG_DIR/client.rb"
+ echo -e "# chef_server_url \"https://CHEF.MYCOMPANY.COM/organizations/MY_CHEF_ORG\"" >> "$CONFIG_DIR/client.rb"
+ echo -e "# chef_license \"accept\"" >> "$CONFIG_DIR/client.rb"
+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"