Search code examples
chef-infrachef-recipediskspace

remove large file from chef cache after chef-client runs


I have a chef recipe that deploys about 300 megs of .tar.gz files. These files are simply uploaded to chef with knife upload cookbooks. After this recipe runs, and is then removed from the node's runlist. A cache of these files persists. I am working with an embedded system and I need to reclaim this space. however if I delete the files, running other recipe puts the files back. Can I tell chef to not sync the files if they aren't part of the run list? How can I skip ever syncing these files


Solution

  • Don’t use a cookbook file for this. Use remote_file instead which gives you much more fine grained control over the file’s lifecycle.