Restart chef recipes if installation fails or updates are available

This is the main task, but I can not find the documentation. I boot EC2 computers with a chef and a chef. If this fails, I would like to fix the recipes, and then reinstall the role and recipes on this computer without listing node and creating it again. I can not find a team that does this.

If I run chef-client on a machine, I get:

chef-client [Wed, 18 Jan 2012 11:23:58 +0000] INFO: *** Chef 0.10.0 *** [Wed, 18 Jan 2012 11:23:59 +0000] INFO: Run List is [] [Wed, 18 Jan 2012 11:23:59 +0000] INFO: Run List expands to [] [Wed, 18 Jan 2012 11:23:59 +0000] INFO: Starting Chef Run for gidsy-staging-web [Wed, 18 Jan 2012 11:23:59 +0000] INFO: Loading cookbooks [] [Wed, 18 Jan 2012 11:23:59 +0000] WARN: Node gidsy-staging-web has an empty run list. [Wed, 18 Jan 2012 11:23:59 +0000] INFO: Chef Run complete in 0.508629 seconds [Wed, 18 Jan 2012 11:23:59 +0000] INFO: Running report handlers [Wed, 18 Jan 2012 11:23:59 +0000] INFO: Report handlers complete 

thanks

+6
source share
3 answers

I ran into the same problem and that is how I solved the problem.

First, I apply the role (s) in the question to the instance with a knife:

 $ knife node run_list add [NODE] [ENTRY] Be sure and include the items in [ENTRY] in quotes (for example, "role[my-role]"). 

Once the role has been applied to the EC2 instance, I then call chef-client on the corresponding instance.

 $ sudo chef-client 

This should significantly speed up your development cycle.

+8
source

The Jordanian answer really helped me, but for those who start a chef like me, I will explain a little more.

I run EC2 and get the above error. This is what I did to solve this problem:

  • On my local machine, run: knife ec2 server list to get the host node on the EC2 server
  • Add a startup list to this node from my local development computer: knife node run_list add i-xxxxx "role[aws-db-deploy]" , where i-xxxxx is your name node
  • ssh to your aws ec2 instance and run the command: sudo chef-client

Hope this helps

+2
source

You can run chef-client with runlist:

 $ sudo chef-client --runlist <role> 
0
source

Source: https://habr.com/ru/post/906297/


All Articles