summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2014-10-10 17:27:56 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2014-10-10 17:27:56 -0700
commit3cb8ecc229999dbe524ff2ba4c4bd693e3c66058 (patch)
tree49437f2fed2332765a4c7da74c0d29ab5b603fd9 /templates
parent735c3d961e00fe66a688997cdf9b39cf8d2a631b (diff)
downloadvyos-cloud-init-3cb8ecc229999dbe524ff2ba4c4bd693e3c66058.tar.gz
vyos-cloud-init-3cb8ecc229999dbe524ff2ba4c4bd693e3c66058.zip
Increase the robustness of the chef module
Add the following adjustments to the chef template and module - Make it so that the chef directories can be provided (defaults to the existing directories) - Make the params much more configurable, and if a parameter is provided in the chef configuration it will override existing template parameters. - Make the template skip lines if the values are None in the configuration so that template lines can be removed if/when this is desirable. - Allow the firstboot json path to be configurable (defaults to the existing location). - Adds a basic set of tests to ensure that good things are happening.
Diffstat (limited to 'templates')
-rw-r--r--templates/chef_client.rb.tmpl52
1 files changed, 43 insertions, 9 deletions
diff --git a/templates/chef_client.rb.tmpl b/templates/chef_client.rb.tmpl
index 538850ca..7b9e6298 100644
--- a/templates/chef_client.rb.tmpl
+++ b/templates/chef_client.rb.tmpl
@@ -9,17 +9,51 @@ you need to add the following to config:
validation_name: XYZ
server_url: XYZ
-#}
-log_level :info
-log_location "/var/log/chef/client.log"
-ssl_verify_mode :verify_none
+
+{#
+The reason these are not in quotes is because they are ruby
+symbols that will be placed inside here, and not actual strings...
+#}
+# This is a generated file, created on {{generated_on}}.
+{% if log_level %}
+log_level {{log_level}}
+{% endif %}
+{% if ssl_verify_mode %}
+ssl_verify_mode {{ssl_verify_mode}}
+{% endif %}
+{% if log_location %}
+log_location "{{log_location}}"
+{% endif %}
+{% if validation_name %}
validation_client_name "{{validation_name}}"
-validation_key "/etc/chef/validation.pem"
-client_key "/etc/chef/client.pem"
+{% endif %}
+{% if validation_key %}
+validation_key "{{validation_key}}"
+{% endif %}
+{% if client_key %}
+client_key "{{client_key}}"
+{% endif %}
+{% if server_url %}
chef_server_url "{{server_url}}"
+{% endif %}
+{% if environment %}
environment "{{environment}}"
+{% endif %}
+{% if node_name %}
node_name "{{node_name}}"
-json_attribs "/etc/chef/firstboot.json"
-file_cache_path "/var/cache/chef"
-file_backup_path "/var/backups/chef"
-pid_file "/var/run/chef/client.pid"
+{% endif %}
+{% if json_attribs %}
+json_attribs "{{json_attribs}}"
+{% endif %}
+{% if file_cache_path %}
+file_cache_path "{{file_cache_path}}"
+{% endif %}
+{% if file_backup_path %}
+file_backup_path "{{file_backup_path}}"
+{% endif %}
+{% if pid_file %}
+pid_file "{{pid_file}}"
+{% endif %}
+{% if show_time %}
Chef::Log::Formatter.show_time = true
+{% endif %}