chef running resource only when a package is present <p>I want to unzip one file in chef recipe but I want to ensure that unzip package is install on that machine before I unzip it. How to do it in chef ?</p> <p>I tried below recipe but on machine where unzip package is install it simply don't execute it.</p> <pre><code>bash 'extract' do cwd '/home/norun/' code &lt;&lt;-EOH unzip wso2.zip EOH only_if { ::File.exists?('/home/norun/wso2.zip') } not_if { ::File.exists?('/home/norun/wso2as-5.2.1') } end apt_package 'unzip' do action :install notifies :run , 'bash[extract]', :immediately end </code></pre> <p>Thanks In Advance</p>