coredump I/O

The adventures of a sysadmin in search for the perfect uptime.

Generating a self-signed SSL Certificate, commands only

| Comments

This post is one of those quick notes to myself, so I can stop searching this info everytime I need it. This is the sequence of commands to create a self-signed SSL certificate. If you need to know what you are doing please go read this post.

I suggest you to paste them one by one, and by you I mean the future me, that will try to paste them all at once and do something stupid.

1
2
3
4
5
openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

cya.

Finding Those Empty Things on Chef With Knife

| Comments

So after a time with a team dealing with chef and knife you end having a pretty vast chef repository. Git helps but it can get a little messy, use the little loops below to search for empty roles run lists or roles with no nodes. They work on chef 0.9, chef 0.10 apparently has some fancy search plugin to do the same (and more) but I haven’t tested it yet.

Also, they were originally one liners but I changed it for the sake of readability.

1
2
3
4
5
6
for file in roles/*
do 
  role=$(basename $file)
  echo -n "Role ${role%.rb}: "
  knife search node "role:${role%.rb}" -i |grep -v '^$' |wc -l
done

You may not have a directory with roles, so you may need to use that:

1
2
3
4
5
6
for file in $(knife role list|egrep -v '\[|\]'|tr -d ' ,"')
do 
  role=$(basename $file)
  echo -n "Role ${role%.rb}: "
  knife search node "role:${role%.rb}" -i |grep -v '^$' |wc -l;
done

To search for those pesky empty run_lists (rare, but it happens, automatic cloud instaces, etc…)

1
2
3
4
5
6
for node in $(knife node list |egrep -v '\[|\]' |tr -d ' ",')
do 
  echo "Node $node:"
  knife node show -r $node
  echo "-----------"
done

Yes, in this last case you will still have to do some manual work and actually find the empty run lists. Search for empty lines, the only ones present on the file will be the empty run lists.

That’s it, cya!

New Blog

| Comments

So, this is a brand new blog, where I will focus on sysadmin and coding stuff. It’s built on the awesome Octopress framework that generates full static content from markdown files and even deploys it using rsync to your site (or github pages, if you are using it). The thing is awesome, I swear.

Stay tunned for more posts on the days coming, I promise that I will try to keep this updated! :)

cya!