Does chef have some built-in way to run some recipes (or parts of it)
once only?
Say, I have the following (here, bash snippet, but could be anything):
bash 'adjust-supervisor' do
code <<-EOF
...some_code...
EOF
end
How would you approach to make sure it only runs once?
I figured I could use something like this in the recipe:
not_if { ::File.exists?("/etc/chef/stamps/some-description.stamp") }
followed by:
file "/etc/chef/stamps/some-description.stamp" do
owner "root"
group "root"
mode "0644"
action :create
end
It allows me to easily re-run by removing the stamp file, if needed.
But not sure it's the optimal way to make sure we run a given thing
once.
How do you approach this?
--
Tomasz Chmielewski
http://www.sslrack.com
Archive powered by MHonArc 2.6.16.