I am new to chef. I have created an AWS ec2 instance as a chef node. I bootstrapped it to the chef-server and the cookbook was uploaded to the chef server. The recipe is as under,
package 'httpd' do
action :install
end
file '/var/www/html/index.html' do
content 'Welcome to my node'
action :create
service 'httpd' do
action [:enable, :start]
After uploading the cookbook and adding to the runlist of my node, the recipe is confirmed on the chef server.
When I paste the public IP of the node in the web browser, the output is shown on the web page. That's working nice.
But when I try to automate the chef-client command, after making some changes in content of the recipe and uploading the cookbook to the chef server it doesn't refreshes the page untill manually chef-client is called.
I have written the following code in /etc/crontab of the node,
* * * * * root chef-client
Also I have tried the method of writing the following code in advance detail while creating the ec2 instance node,
#!/bin/bash
sudo su
yum update -y
echo "* * * * * root chef-client">> /etc/crontab
By doing this, the * * * * * root chef-client
code in written to the /etc/crontab file, but the automation still does not work and chef-client has to be called manually.
how the automation of chef-client will work properly?