I have 7 files and 1 war. I need to change values when I deploy them. I have this:
##usuario
#alfresco.user=*****
alfresco.user=********
##pass
#alfresco.p
Here is an example of how you can use Chef to uncomment a line in a configuration file. The ruby_block
is protected with a ::File::grep
. The test for Debian is just for fun.
pam_config = "/etc/pam.d/su"
commented_limits = /^#\s+(session\s+\w+\s+pam_limits\.so)\b/m
ruby_block "add pam_limits to su" do
block do
sed = Chef::Util::FileEdit.new(pam_config)
sed.search_file_replace(commented_limits, '\1')
sed.write_file
end
only_if { ::File.readlines(pam_config).grep(commented_limits).any? }
end if platform_family?('debian')