L15 – Copy config files to the Node
We will make a change top the php.ini file and ensure chef updates all nodes next time a configuration run is performed.
Copy /etc/php.ini from a node to ~/cookbooks/php/files/default
Then make a change, e.g. add a line to the php.ini file
[PHP]
:: php.ini managed by chef
etc
Â
$ cd ~/cookbooks/php/recipes/
$ vi default.rb
package “php” do
action :install
end
Â
cookbook_file “/etc/php.ini” do
source “php.ini”
mode “0644”
end
Â
$ knife cookbook upload php
NODE
====
$ chef-client
Old file is saved as /var/chef/backup/etc/php.ini.chef-date.nnnn
Discussion ¬