Run bash script (special characters )

I need to execute the bash command which has single quotes, the following definition doesn't work for me. I also tried using the "/" backslash to escape.

bash 'run chefclient' do
code <<-EOH
CHEF_LICENSE='accept' chef-client

I use this in packer, maybe it'll work for you?

"echo "chef_license 'accept'" | sudo tee -a /etc/chef/client.rb"

If you update to a recent version of packer, the license is supported

1 Like