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.
This commit is contained in:
Joshua Harlow
2014-10-10 17:27:56 -07:00
parent a21d8cec76
commit 42faf0279f
4 changed files with 229 additions and 137 deletions

View File

@@ -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 %}