Chef Check Package is already installed

316 views Asked by At

Recipe

cookbook_file '/tmp/awscli-exe-linux-x86_64.zip' do source 'awscli-exe-linux-x86_64.zip' owner 'root' group 'root' mode '0755' action :create notifies :run, "bash[install_awscli]", :immediately end

bash "install_awscli" do user "root" cwd "/tmp" code <<-EOH unzip awscli-exe-linux-x86_64.zip (sudo ./aws/install && aws --version) EOH action :nothing end

Error an "bash" "/tmp/chef-script20200510-1596-1thl7p2" returned 1

My question is that what is the proper way to check if a certain package is already install so that it will not be re installed from the recipe?

1

There are 1 answers

0
Edcel Cabrera Vista On

Changing the directory from /tmp into some persistent directory solve the issue..