Puppet Stand Alone – Templates, Configs

April 29, 2010 – 6:12 pm

I’m working on getting all our servers standardized with puppet to minimize installation and maintenance hassle. Pretty exciting.

I’m setting all this up with puppet standalone. I don’t think we really gain anything by using the daemons, so it’s just a simple call to

puppet site.pp -v

And the changes are applied.

I ran into a snag today trying to get templates working. I kept getting the below error when trying to update my test system:

Could not find template ‘push.erb’ at /etc/puppet/manifests/site.pp:32 on node somename.myserver.local

Using strace:

[root@somename manifests]# strace -o ~/trace.txt -e trace=file puppet site.pp
Could not find template 'push.erb' at /etc/puppet/manifests/site.pp:32 on
node somename.myserver.local
[root@somename manifests]# tail -n 1 ~/trace.txt
stat("/var/puppet/templates", 0x7fffb7073a30) = -1 ENOENT (No such file or directory)

Fortunately there’s also config tool to check this stuff:

[root@somename manifests]# puppet --configprint templatedir
/var/puppet/templates

I have everything under /etc/puppet, NOT /var/puppet. I want the templates directory to reside in there too. I had a /etc/puppet/puppetd.conf file, and I set the templatedir variable in there under [puppetd] and [puppetmasterd] and [puppet] (I really had no idea which it needed) – and when that still didn’t work I tried renaming the config to puppet.conf. These are the lines I needed:

[puppet]
templatedir=/etc/puppet/templates

Thanks to the guys in #puppet on freenode for helping me sort this out.

See the puppet site and documentation for more info.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit

Mount afp share over command line

April 29, 2010 – 1:15 pm

This is so useful to me that I have to repost it here, just in case it disappears.

# create a folder for the mount point
sudo mkdir /Volumes/music

# mount the disk
mount -t afp afp:/// /Volumes/music/

#refresh the finder for when you get back
disktool -r

# when you're done
sudo umount /Volumes/music

Found on macosxhints

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit

Python Module Docs

April 27, 2010 – 5:12 pm

I’ve been trying to get into Python in my spare time, since it’s got such a huge volume of modules and looks like it should be easy to be ripping it up in no time. But of course, I have my complaints.

Fortunately I don’t need to write a long blog post, this guy did it for me. It’s kind of alarming this post is from 2 years ago and the docs are still a major problem.

I’ve got a gripe with every language (who doesn’t?) but this is really killing me. Such great potential.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit

MacBook Air Conclusion

April 20, 2010 – 2:25 pm

358B0C2A-FB2E-462B-BE28-05D8D4D47AC9.jpg

I made a post back in December regarding my MacBook Air and a battery life issue.

About 2 weeks ago, I brought the Air back to the Apple store again, despite being completely shot down the first time. I had a 12:30 appointment, got there right at 12:30, but no one talked to me for a few minutes, so by the time I got someone’s attention, I was informed since I was late, they cancelled my appointment.

At this point, one of the non-genius people saw how frustrated I was and came over to talk to me. I explained the situation, and she told me I could do a drop-off thing where I leave it with them. I got a call the next day, they can’t figure out what’s wrong with my Air and I’m getting a new laptop. Amazing that it took so long to get to this point – considering I haven’t been able to use the computer regularly for the entire year. I tried to get them to let me upgrade to a MB Pro, but no dice.

I got the call today that my new Air was ready for pickup. I showed up at the store, and asked the guy again about swapping the Air for a Pro (paying the difference, of course). Apparently now it’s not a problem.

Conclusion: the battery drain was because the computer was completely hosed. New computer seems awesome. I am happy again.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit

Bash Quick Tip – Subshells

April 15, 2010 – 1:12 pm

terminal-icon-512x512.png
When you’re in a shell, and you want to do 1 or 2 commands in another brand new shell, but don’t feel like opening a new window, try using a subshell.

Here’s an example:

~ jhaddad$ pwd
/Users/jhaddad
~ jhaddad$ ( cd /tmp/; touch bacon.txt )
~ jhaddad$ pwd
/Users/jhaddad
~ jhaddad$ ls -lah /tmp/bacon.txt
-rw-r--r--  1 jhaddad  wheel     0B Apr 15 13:09 /tmp/bacon.txt

Why I like it: I can very quickly fire off a command that involves changing directories without having to switch back to my pwd.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit

SSH Reverse Tunnel To Access Box Behind Firewall

March 4, 2010 – 3:31 pm

I frequently need to get access to a machine behind a firewall to do some web development, but I don’t have a VPN available. Not a problem – just use a reverse SSH tunnel. By the end of this tutorial, we’ll be able to SSH to the remote server, as well as view any web pages that server has access to.

We’re going to connect to the remote server using our local port 5000 – here’s how.

The 2 boxes we’ll use will be my.home.com (also referred to as localhost) and my.remote.com. We’re assuming you somehow have access to my.remote.com – maybe while at work or through some tool like Citrix. You might want to add monitoring to this to make it stable, but that’s outside the scope of this tutorial. Also, you’ll need direct outside access to your home machine – so you might need to configure your router to do port forwarding.

  1. First, from the remote server, SSH back to yourself.

    ssh -R 5000:localhost:22 username@my.home.com

    You can now SSH to the remote box through the tunnel by typing

    ssh localhost -p 5000

    All local traffic that connects to port 5000 is being forwarded via SSH through your reverse tunnel, back to port 22 on the remote machine.

    The other half of the problem is viewing web pages of dev boxes behind the firewall – it turns out this is pretty easy once you’ve got the reverse proxy going.

  2. On your home machine type the following:

    ssh -D 9999 username@localhost -p 5000

  3. Next, you’ll need to set up a SOCKS proxy. Open your browsers settings and it to the server “localhost” on port 9999. This will forward your traffic back through the tunnel and to the remote server. I do this using FoxyProxy & Firefox, so I can limit the domains that actually route through the proxy.

    Screen shot 2010-03-04 at 2.23.30 PM.png

  4. That’s about it – you should now be able to visit any site that’s in the private network. You now have command line and full browser access.

    Helpful references:

    howtoforge.com/reverse-ssh-tunneling

    embrace ubuntu

    These icons link to social bookmarking sites where readers can share and discover new web pages.
    • Digg
    • del.icio.us
    • Reddit

Textmate – Stop ._ Backup Files

February 14, 2010 – 9:08 pm

Pretty sure this stops TextMate from creating the ridiculous backup files in my network shares.

defaults write com.macromates.textmate OakDocumentDisableFSMetaData 1

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit

CANCEL MY GOOGLE!

February 12, 2010 – 12:25 pm

I can’t believe this stuff exists… I love the internet.

hello i am 82 years old and google is on my computer withour permission IT IS UNCONSTITUTIONAL. my compoter is slow now and i want to contact the internet what is the number?

Original awesome post

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit

Running Puppet Master on Mac OS X Snow Leopard

February 2, 2010 – 1:24 pm

As of a few hours after this post, I’ve given up trying to get Puppet Master running on Snow Leopard. There appears to be an issue with the SSL certificates generated that’s preventing puppetd from getting it’s recipes. There doesn’t appear to be any way to disable this. I have switched to a CentOS VM, which worked perfectly the first time. The Unixy underpinnings of my Mac seem to be getting less and less useful every day.

I kept getting the below error when trying to start puppet, even though I had created the user and group through the accounts prefs pane. Apparently that’s not good enough for the PuppetMaster to run.

For some reason this figuring this out was a huge pain. These are the steps I took to getting it installed. If it looks simple, well, that’s because it really is. Most people suggest solving this with MacPorts, but then I still wouldn’t know how to set up users and groups on Snow Leopard, so I’d just be screwing myself over in the long run.

Anyways, here’s the error I was getting:

err: /File[/var/puppet/rrd]: Failed to retrieve current state of resource:
Could not find group puppet

How to solve:

  1. Install Facter and Puppet

  2. This is easy enough – Snow Leopard comes with Ruby by default. Both can be downloaded from the Reductive Labs download page.

  3. Install Server Admin Tools.

  4. As of this blog entry, you can find them in Apple’s downloads section, although it was kind of a pain to find.

  5. Enable Remote Management for youself

  6. I was not able to connect to localhost until I enabled this option. You can control which users have management rights, so I’m not to concerned here.

  7. Create user and group for puppet.

  8. Use the GUI tool to create new a puppet user and group. You should now be able to start the pupptermasterd (yay!)

I’ll expand this post if I realize I forgot anything, or if questions come in.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit

Dear Priceline: Seriously, WTF?

January 26, 2010 – 1:37 pm

Dear Priceline,

You really can’t do better than $680 for a flight from LAX to Vegas? Seriously, why is this the #1 listing? For those of you who aren’t aware, it’s a 1 hour flight that normally costs $60 each way.

Screen shot 2010-01-26 at 12.23.21 PM

Southwest (cropped out middle prices for simplicity)

Screen shot 2010-01-26 at 12.32.20 PM

Lame.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit