Share single .bashrc across multiple linux machines

Often I manage many servers and find myself wishing I had the same shortcuts available on my workstation, also present on the server.

Normally I’d use puppet to manage the .bashrc or .bash_profile, but my workstations don’t have a puppet master. To work around this, I store my .bash_profile on github, and have a script to update it automatically.

Here is the script to update my bash_profile

    #!/bin/bash
       curl -L https://gist.github.com/spuder/11360474/raw/ > ~/.bash_profile

https://gist.github.com/spuder/11360474

The actual bash profile is located here

    alias ls='ls -G'
    alias sl='ls -G'
    alias up='cd ..'
    alias redo='sudo \!-1'
    alias sdou='sudo'
    alias suod='sudo'
    alias sodu='sudo'
    alias tailf='tail -f'
    # Open sublime text editor with command subl
    if [ ! -f /usr/local/bin/subl ]; then /bin/ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl; fi;

https://gist.github.com/spuder/11360447

Now on every machine I manage, I run the following command just once

    curl -L https://gist.github.com/spuder/11360474/raw/ | bash -x

After that, I can just execute the bashupdate alias to pull down the latest version.

    spuder@Spuders-MacBook-Pro:~$ bashupdate

Open a new terminal, or source your ~/.bash_profile and you will instantly have the new changes. Pretty slick right?

Setting up puppet board with Apache

PuppetDB appears to be the way of the future. By leveraging PuppetDB, some enterprising individuals have written a web interface that knocks the socks off of the regular puppet dashboard. It is called puppetboard

Clean and elegant – puppetboard

View of a node

Puppetboard with Apache

Normally puppet board requires Passenger. Here is how to configure puppet board to work with Apache instead.

You can install puppet board on cent with apache using the mod_wsgi plugin

Clone & install  puppetboard

git clone https://github.com/nedap/puppetboard.git /var/www/puppetboard
sudo yum install python-pip
Install mod_wsgi yum install mod_wsgi.x86_64

(You can see what was installed with the following)
rpm –query –list mod_wsgi.x86_64

Verify that /etc/httpd/confi.d/wdgi.conf exists and has the following content

LoadModule wsgi_module modules/mod_wsgi.so

Add a vhost to /etc/httpd/

$sudo vim /etc/httpd/conf/httpd.conf
<VirtualHost *>
 ServerName foo.bar
WSGIDaemonProcess puppetboard user=apache group=apache threads=5
 WSGIScriptAlias / /var/www/puppetboard/wsgi.py
<Directory /var/www/puppetboard>
 WSGIProcessGroup puppetboard
 WSGIApplicationGroup %{GLOBAL}
 Order deny,allow
 Allow from all
 </Directory>
 </VirtualHost>

 Restart Apache
 sudo apachectl -k stop
 sudo /etc/init.d/httpd start

If you are running CentOS/RHEL You get the following errors, it is because the WSGI root path is incorrect.

[Fri Jan 03 16:53:13 2014] [error] [client 10.1.5.231] (13)Permission denied: mod_wsgi (pid=2029): Unable to connect to WSGI daemon process 'puppetboard' on '/etc/httpd/logs/wsgi.2024.0.1.sock' after multiple attempts.

Solution
Add this to /etc/httpd/conf/httpd.conf *before* the vhost

WSGISocketPrefix ../../var/run/wsgi

Restart Apache and puppet board should be installed

Additional Resources

https://uwsgi.readthedocs.org/en/latest/Configuration.html
https://groups.google.com/forum/#!topic/modwsgi/UmNPV-2nQMM
https://www.digitalocean.com/community/articles/how-to-set-up-apache-virtual-hosts-on-centos-6
https://code.google.com/p/modwsgi/wiki/ConfigurationIssues
https://code.google.com/p/modwsgi/issues/detail?id=291