I have two resources in my recipe. The first one is a user
resource that sets the user uid/gid/home directory etc. It uses supports :manage_home => true
.
My second resource is a bash
resource. Currently the script runs on every chef-client run, which is a little unnecessary. I want the script to run only if the manage_home
was invoked when running the user resource (eg. run the script if the user's home directory was changed and files were moved over, otherwise do nothing).
I have only been able to find examples of using only_if
with some pure Ruby condition (eg. if a certain file exists, if a node has a certain element in its run list, etc), but what I want to do requires the condition to be linked to the result of another chef resource. I know that the user resource just runs usermod
(or useradd
), which doesn't seem to give any indication of whether the home directory was moved or not. So is this even possible?