ruby - Chef: Increment value in a file each time the cookbook is applied -
one of recipes echoes static value file each time cookbook applied server, e.g.
bash 'example' code <<-eof echo "1" > /path/file.txt eof end
i increment value each time cookbook applied server. next time, /path/file.txt contain value "2", "3"...
this weird thing since non-convergent whatever floats boat:
ruby_block 'weird thing' block path = '/whatever.txt' value = io.read(path).to_i io.write(path, (value + 1).to_s) end end
Comments
Post a Comment