Wednesday, December 28, 2016

Logitech G602 fix middle click button / wheel not working

If your Logitech G602 scroll wheel button stops working, there is an incredibly simple fix. Here's an instructable on how to fix it by replacing the switch, but down in the comments is a simple solution that worked for me and a lot of others it seems. Simply give the mouse a good rescue breath. Cover the mouse wheel hole with your mouth and blow hard, your mouse is probably working now!

Wednesday, March 9, 2016

vagrant with Puppet 4.x - Could not parse application options: invalid option: --manifestdir

There's a bug with Vagrant <= 1.81 and Puppet 4.x where it cannot execute the Puppet provisioner since Puppet no longer supports the --manifestdir option.  The easy solution is set the Puppet environment and path on the Puppet provisioner.  Your vagrant file should now look like:

  config.vm.provision "puppet" do |puppet|
    puppet.environment = "production"
    puppet.environment_path = "../../"
    puppet.manifests_path = "vmconfig/manifests"
    puppet.manifest_file = "init.pp"
    puppet.module_path = "vmconfig/modules"

Wednesday, February 17, 2016

Retreive VMWare UUID from Linux guest

If you want to access the vmware / vsphere UUID for a Linux VM within the OS, run:

sudo dmidecode -s system-serial-number

Thursday, November 19, 2015

Puppet r10k cron job

It seems I'm continually tweaking the cron job that runs r10k on my Puppet Masters.  It's not quite enough to just run r10k deploy environment -pv since we need to make sure a previous run isn't still running.  Sometimes git will hang as well, hanging the whole process indefinitely, so we need to set a timeout to kill the process.  Lastly, there are PATH issues you have to deal with.  Here's my current script that gets called by a cron job in the pe-puppet user's crontab:


# Only run if r10k isn't already running, in case a previous run is still going
if ! pgrep -f 'r10k deploy' > /dev/null
    timeout -s 9 1200s /usr/local/bin/r10k deploy environment -pv > /tmp/r10k.log 2>&1

Monday, October 26, 2015

Automatically create Jenkins jobs to run puppet-lint on multiple github repos

If you have multiple git repos for your Puppet modules, as opposed to a single monolithic repo, it is possible to have Jenkins automatically create jobs for all of your repos.  In this example we'll be using Jenkins to create puppet-lint jobs for all git repos in a Github Enterprise organization.  This should be a good starting point towards a more robust continuous integration/delivery pipeline for your Puppet code.

First, install the Job DSL Plugin in your Jenkins instance.  You'll also need to install puppet-lint on your Jenkins master or slave server. 

Next, you'll need to create a Jenkins job that will be used to create all of the other jobs.  This is called the seed job.  More info here.  Create a standard freestyle project and add a Process Job DSL build step.  In the DSL Script box, you'll need to edit this Groovy script to fit your needs.  This was specifically written for Github enterprise, but you should be able to get this to work with regular Github by adjusting the URLs on lines 7 and 19.

This job uses this script to run puppet-lint against each repo.

Once you do a build on the seed job, you'll have a new job created for every git repo in your Github organization.

Thursday, July 16, 2015

Puppet Enterprise Console: Programmatically add nodes to a node group.

I spent the last two years working with Chef, and I never felt the need to blog much about what I was doing because everything I needed was always easy to find.  In other words, the documentation for Chef provided by both Opscode and the community is great.  I can't always say the same about Puppet, so a lot of times I find myself having to really dig to find solutions.

In this case I needed a way to script adding a lot of nodes to a Puppet Console node group.  Later versions of Puppet Enterprise have the Node Classifier Endpoints, but in this environment we were running 3.2.3.  You can use the Console Rake API instead.

/opt/puppet/bin/rake -f /opt/puppet/share/puppet-dashboard/Rakefile RAILS_ENV=production node:addgroup['','mygroup']

cat newhosts | xargs -I {}  /opt/puppet/bin/rake -f /opt/puppet/share/puppet-dashboard/Rakefile RAILS_ENV=production node:addgroup['{}','mygroup']

Monday, January 19, 2015

Fix screen tearing issues with Mint 17 and NVidia

I've been fighting screen tearing issues with Mint and my NVidia GTX 760 for the past year.  I use four monitors, and on each monitor there is a horizontal line where tearing will occur, but only on this line (usually tearing occurs randomly across the whole screen).  It affects full screen games, videos, and windows alike.  Toggling vsync in the nvidia-settings control panel had no effect.

The standard /etc/environment options could not resolve it:


I upgraded to Mint 17.1 which added a new option in the general settings menu to "Disable compositing for full-screen windows".  This didn't help either.  Finally I came across this thread which had the answer.  The key is to add "ForceFullCompositionPipeline = On" to the screen settings in xorg.conf.

Open up /etc/X11/xorg.conf.  If you don't have xorg.conf, run "sudo nvidia-settings", click "X Server Display Configuration" on the left, then click "Save to X Configuration File" at the bottom.

In /etc/X11/xorg.conf you should have a line that looks like:

Option "metamodes" "nvidia-auto-select +0+0"
Change this to :
"Option "metamodes" "nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"

In my case I have multiple monitors, so mine looks like:

 Option         "metamodes" "DVI-I-1: nvidia-auto-select +1920+1050 { ForceFullCompositionPipeline = On }, HDMI-0: nvidia-auto-select +240+0 {rotation=invert, ForceFullCompositionPipeline = On }, DVI-D-0: nvidia-auto-select +3840+1050 { ForceFullCompositionPipeline = On }, DP-1: nvidia-auto-select +0+1050 { ForceFullCompositionPipeline = On }"
You also need to add (important!):
Option    "TripleBuffer" "True"

Finally my tearing issues are resolved for full screen games, windowed games, full screen video, and windowed video.  Tested on Mint 17.1 with an NVidia GTX 760 and NVidia driver version 346.35.

For reference, here is my full xorg.conf file.  I do not have CLUTTER_PAINT and CLUTTER_VBLANK set in /etc/environment.  I have Sync to VBlank turned on in nvidia-settings.  I do not have "Disable compositing for full-screen windows" checked in the Mint General Settings widget.