Puppet-dashboard Installation


Continue with my previous Puppet Installation, here is how I installed the puppet dashboard which offers a web UI.

Install puppet-dashboard

sudo yum install puppet-dashboard

Config /usr/share/puppet-dashboard/config/database.yml

production:
database: dashboard_production
username: dashboard
password: puppet
encoding: utf8
adapter: mysql

Create MySQL database for puppet-dashboard

CREATE DATABASE dashboard_production CHARACTER SET utf8;
CREATE USER ‘dashboard’@’localhost’ IDENTIFIED BY ‘puppet’;
GRANT ALL PRIVILEGES ON dashboard_production.* TO ‘dashboard’@’localhost’;

Prepare Schema

rake RAILS_ENV=production db:migrate

Start puppet-dashboard

sudo -u puppet-dashboard /usr/share/puppet-dashboard/script/server -e production &

Configure  puppet master server

#/etc/puppet/puppet.conf (puppet master)

[master]
node_terminus = exec
external_nodes = /usr/bin/env PUPPET_DASHBOARD_URL=http://localhost:3000 /usr/share/puppet-dashboard/bin/external_node

Restart puppet master server

/etc/init.d/puppetmaster restart

Start delayed job workers

sudo -u puppet-dashboard env RAILS_ENV=production /usr/share/puppet-dashboard/script/delayed_job -p dashboard -n 2 -m start &

Test

In Agent: sudo puppet agent

Go to the http://Master_Server_IP:3000

Reference: http://docs.puppetlabs.com/dashboard/manual/1.2/bootstrapping.html

Puppet Installation


In my lab I have set up the CentOS 6.3 as the Puppet Master server, and Ubunt 12.10 as the Puppet agent.

Install Puppet-Server on CentOS (Master)

sudo rpm -ivh http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-6.noarch.rpm
sudo yum install puppet-server

Install Puppet on Ubuntu (Agent)

wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb
sudo dpkg -i puppetlabs-release-precise.deb
sudo apt-get update
sudo apt-get install puppet 

Specify the Puppet Master server name in /etc/puppet/puppet.conf in Agent

[main]
server=CentOS.my.lab

Enable the service

In Agent: sudo puppet resource service puppet ensure=running enable=true
In Master: sudo puppet resource service puppetmaster ensure=running enable=true

Request (Agent) and Sign Certificate (Master)

In Agent: sudo puppet agent –test (or sudo puppet agent, when with ‘–test’ it only runs once)
In Master: sudo puppet cert sign –all

Test – Create a file in the Agent

In Master: 

vi /etc/puppet/manifests/site.pp

node default{
file {“/tmp/puppet_test_file”:
content => “this is a puppet test file”}
}

In Agent: sudo puppet agent –test

Reference: http://docs.puppetlabs.com/guides/installation.html

Disable the blinking wifi LED in Ubuntu


The wifi LED keeps blinking in my Ubunut 12.10 laptop (Intel chips) when it is connected. To disable it, I have changed the led_mode to 0. Here is how I did it:

1) Change to root user.

jchen@JC:~$ sudo -i
[sudo] password for jchen: 

2) Find out the wifi module.

root@JC:~# lsmod | grep iw
iwlwifi               348584  0 
mac80211              461203  1 iwlwifi
cfg80211              175574  2 iwlwifi,mac80211

3) Change the led_mode to 1.

root@JC:~# vi /etc/modprobe.d/iwlwifi.conf
# iwlwifi will dyamically load either iwldvm or iwlmvm depending on the
# microcode file installed on the system.  When removing iwlwifi, first
# remove the iwl?vm module and then iwlwifi.
remove iwlwifi
(/sbin/lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs /sbin/rmmod)
&& /sbin/modprobe -r mac80211
options iwlwifi led_mode=1

4) Reload the wifi module

root@JC:~# modprobe -r iwlwifi && modprobe iwlwifi 
root@JC:~# exit
logout
jchen@JC:~$ 

Screen brightness reset in Ubuntu


My Ubuntu laptop’s screen brightness resets everytime after reboot. I have found a way to make the brightness adjustment ‘stay permantly’:

1) Adjust the brightness to the level that I like, then run ‘cat /sys/class/backlight/acpi_video0/brightness ‘. The command will return the brightness level in a integer value. Mine is 12.
2) Add the line ‘echo 12 > /sys/class/backlight/acpi_video0/brightness‘ into the /etc/rc.local file.

Fortinet SSL VPN Client in Ubuntu


It is intereting that the Fortinet SSL VPN client works fine in my Windows machine, but does not work in my Ubuntu laptop. I have found the reason is that a few routes are missed in the routing table. To make it work, I wrote a script to manually add those routes after VPN is connected.

Create an executable file named VPN under /usr/local/bin. Next time just run the command VPN to connect vpn and add routes.

#!/bin/bash

# Start VPN
/home/jchen/Downloads/forticlientsslvpn/forticlientsslvpn&

# Check if ppp0 is ready
while ! ifconfig  | grep ppp0 >/dev/null 2>&1
do
echo VPN is connecting…
sleep 3
done

# Add routes
IP=`ifconfig ppp0 | grep ‘inet addr’ | awk ‘{print $2}’ | cut -d’:’ -f2`
sudo route add -net 1.1.1.0/24 gw $IP dev ppp0
sudo route add -net 2.2.2.0/24 gw $IP dev ppp0