0

I'm working on setting up a Linode VPS from scratch but instead of doing it manually I wish to use Chef so I can easily automate it in the future.

The question I have is:

I realise you can set up packages and whatever but how do you accomplish all the other smaller steps:

For example, set the host name, security setup, firewall.

I am sort of following this guide but want to change some parts to suit my application:

http://feross.org/how-to-setup-your-linode/

2
  • This seems to be asking at least 3 or more questions... all of them complex enough to be their own subject matter.
    – vgoff
    Nov 17, 2012 at 4:04
  • Sorry, this question is way too broad for a simple Q&A site. If you can break it down into bit size questions they may stand on their own, but we certainly aren't here to do your job for you. Chef has guides and documentation, you need to show that you've made a minimum effort to review it first.
    – Chris S
    Nov 17, 2012 at 5:00

1 Answer 1

2

Take a look at Opscode's official cookbooks repository and see if there's something fitting your needs (or that you can easily modify).

If not, you can do script blocks to execute code in your recipes. Documentation for that can be found here.

4
  • ok, Just for an example, could you show me how I would write this as part of my solo.rb file? echo "plato" > /etc/hostname hostname -F /etc/hostname If it exists, edit the file /etc/default/dhcpcd to comment out the SET_HOSTNAME directive: File excerpt:/etc/default/dhcpcd #SET_HOSTNAME='yes'
    – rctneil
    Nov 10, 2012 at 17:52
  • Hmm. I wouldn't put it in the solo.rb file. I would set up a specific cookbook that will be included in solo.rb, which will be specific to your institution that will do that, and set up a node.json with the specific settings for that instance (e.g., hostname). I also wouldn't edit a file; I would set up a template in the cookbook and would overwrite a given file with what you want.
    – cjc
    Nov 10, 2012 at 22:11
  • Sorry, I meant put it in a recipe. I have a cookbook called main and have started to put it in a recipe within main. You said to create a template and overwrite a file but if I make a template with the hostname stuff in it then surely it'll overwrite what is already in that file? How do I deal with that? Basically my aim is to create a chef setup which will pretty much follow this: rubysource.com/deploying-a-rails-application plus the steps on linode.com on securing the server. Thats all I want it to do for now and yes maybe chef is overkill for one server but there we go! :-)
    – rctneil
    Nov 11, 2012 at 11:19
  • I ended up moving to Ansible for my server automation. Works really nicely.
    – rctneil
    Feb 28, 2014 at 21:40

Not the answer you're looking for? Browse other questions tagged .