Libert Libert - 2 months ago 15x
Ruby Question

Chef - Change files group recursively

I have the following structure:


What I'm trying to achieve is:

sudo chgrp -R tomcat conf

Change all the files in the 'conf' directory to the group 'tomcat'

I tried this:

directory "/opt/conf" do
group 'tomcat'
mode '0070'
recursive true

but it just change the group to tomcat but not the files inside the conf directory.

How can achieve to change all the content of the conf directory using recipes?


That is not something the directory resource supports. You'll have to use chown or chgrp in an execute resource. There is a good reason for this, I promise, but it's a long and winding tale of convergent ontologies.