Custom Facts in Puppet

  ================== CUSTOM FACT ================= puppet@testserver:/opt/puppetserver/conf/environments/test/modules/helloworld/lib/facter> cat dhcp_dnsdomain.rb     Facter.add(“dhcp_dnsdomain”) do       confine :operatingsystem => ‘SLES’       setcode do         Facter::Core::Execution.exec(‘/usr/sbin/dhcpcd-test eth0 | grep DNSDOMAIN | cut -d$”\'” -f 2 | rev | cut -d”.” -f 1,2 | rev’)       end     end ==================== PUPPET MANIFEST ============ puppet@testserver:/opt/puppetserver/conf/environments/test/modules> cat helloworld/manifests/init.pp class helloworld { notify {

Puppet practical: check $interfaces for IP address

EXAMPLE on checking IP Address on available network interfaces (via Puppet) $ifs = split($interfaces, ‘,’) notify {” Interface list: $ifs “: } defines::show_ip_test { $ifs: } define show_ip_test { $inf = “ipaddress_${name}” $ip = inline_template(‘<%= scope.lookupvar(inf) %>’) #            notify {“IP ${name} :  $ip”: } if $ip =~ /^153\.100\.[3-6]{1}\.*/ { #             if $ip =~ /10\.182\.42.*/ {

Verifying a VMware Tools build version (1003947)

Symptoms This article describes how to determine the version of VMware Tools installed on a virtual machine and to check if the installed version corresponds to the version on the ESXi/ESX host. Resolution Windows: From the Console or an remote desktop session, open VMware Tools from the Task Bar and click About. From the directory

How to Install MiniDLNA on FreeNAS 9.3

Could not find minidlna package on freebsd website as described in various docus. But then found a*.pbi file that did the trick.   1.  http://www.freenas.org/downloads/plugins/9/x64/ downloaded – http://www.freenas.org/downloads/plugins/9/x64/minidlna-1.1.0_1-amd64.pbi 2. In FreeNas WebGUI:  Plugins -> Available -> Upload Upload the file from step 1. Plugin customplugin_1 will be installed 3. After uploading : Add Storage to Jail customplugin_1 Take

▶ Bash Text manipulation: sed is better then a grepped cat !

When you like to learn about regex then sed is a good starting point. Here is an example of some text manipulation. See below snippets of a txt file which needs these adjustments cat -n <file>.pp | grep notify 33  #                notify {“WARNING: numberoforasids:  $numberoforasids” : } 46                           notify => Service[‘postfix’], 71                          notify => Service[‘postfix’],

▶ Exclude .git from tar ball creation

The tar command gives a few possibilities: 1 . General: tar cvfz app.tar.gz --exclude ".git/*" --exclude ".git" <root-dir> 2. GNU tar      To exclude version control system directories:     tar --exclude-vcs This will exclude svn, git metafiles etc. tar cvfz app.tar.gz <root-dir> --exclude-vcs Source: http://stackoverflow.com/questions/3069522/tarballing-without-git-metadata