Ad
2703, 2016

Setup an L2TP/IPSEC VPN On Your Ubitquiti EdgeRouter

By |March 27th, 2016|Categories: Uncategorized|Tags: , , , , , , |

The planned follow up to the Ubiquiti UniFi AP deployment/RaspberryPi controller post about running an ELK stack on the controller is on hold; there are no preexisting binaries for the ARM platform and a successful compile from source has eluded me so far.  So instead we’re going to walk through setting up an L2TP/IPSEC VPN up on Ubiquiti’s EdgeRouter line of routers.  Ubiquiti has a good guide here that will get you 90% of the way there, but is missing a few key pieces of info.

(more…)

2802, 2016

Deploying Ubiquiti UniFi APs with a RaspberryPi 2 Controller

By |February 28th, 2016|Categories: Uncategorized|Tags: , , , , , , , |

I recently got fed up with the mediocre coverage and speeds of my home wireless network even after throwing DD-WRT on the pair of APs (Netgear and Linksys .11n) to eek out all the performance I could.  So I decided to take the plunge and go up market a bit with a couple APs from Ubiquiti Networks.

Ubiquiti UniFi APsI went with a pair of UAP (.11n) and UA-AC-LR (.11ac) units for a mix of coverage in light usage areas and better performance in high usage areas, along with a RaspberryPi 2 to act as the controller.    Since the UniFi APs are becoming more popular among home users, and I can’t be the only one wary of putting management functions in the cloud, I decided to document the setup process. (more…)

2402, 2016

How to Install git on Centos 7

By |February 24th, 2016|Categories: Uncategorized|Tags: , , , |

I found my self needing git to pull down scripts for ansible. Thus this is how to configure git on Centos 7.

 

  1. # yum install git -y
  2. git --version
  3. You should see a version like this. Install Done!

git version

 

  1. Next lets configure it!
  2. # git config --global user.name "Your Name"
  3. # git config –global user.email “[email protected]
  4.  # git config –list
  5. You should see the following, and we are done!

configgit

  1. Lets create a new location for our git repository
  2. mkdir /git
  3. cd /git
  4. git init
  5. now lets pull down a configure we want to use.
  6. the command git clone (URL) clones a entire repository down to your server or workstation.
  7. Enjoy!

 

Sources.

How To Install Git on CentOS 7 https://www.digitalocean.com/community/tutorials/how-to-install-git-on-centos-7

Using Git with Github. http://blog.scottlowe.org/2015/01/26/using-git-with-github/

A Non-Programmer’s Introduction to Git http://blog.scottlowe.org/2015/01/14/non-programmer-git-intro/

credit to Scott Lowe and Josh Barnett

 

 

 

Roger L

2402, 2016

PowerCLI: Get VM disk usage per cluster

By |February 24th, 2016|Categories: Uncategorized|

powercli

 

 

Today I was asked to gather a list of all VMs within a given cluster and report on their disk usage (all the VMs are thick provisioned) and currently do not have a tool to perform a seemly simple task. After some searching I have found many versions of this script around the internet but none that quite suited me needs. I have modified about 50% of the original script to suit my needs and added these features.

  • Prompts for vCenter hostname or IP
  • Requires user to select a cluster
  • Queries vCenter for list of cluster names (for use above)
  • Limits results to specified cluster
  • Prompts for output filename
  • Default saves to current user’s Documents folder
  • Prints location of filename
  • Auto launches file once complete

I should also mention that I am not a script writer. My abilities exist in finding, understanding (most of the time), and modifying existing Powershell scripts. I will be unable to assist with drastic modifications to any script.

Requirements: VMware PowerCLI, vCenter Credentials with appropriate permissions

How to run: Save below script to .ps1 format and run from PowerCLI. No need to modify anything to make compatible with your environment.

$vCenterName = Read-Host -Prompt ‘Enter vCenter hostname or IP’
Write-Host “Connecting…”
connect-viserver $vCenterName

$MyCollection = @()

get-cluster | select-object name
$ClusterName = Read-Host -Prompt ‘Enter Cluster Name (must be exact)’
$ClusterFilter = get-view -ViewType ClusterComputeResource -Property Name -Filter @{“Name” = $ClusterName } | select -ExpandProperty MoRef

$AllVMs = Get-View -ViewType VirtualMachine -SearchRoot $ClusterFilter | Where {-not $_.Config.Template}
$SortedVMs = $AllVMs | Select *, @{N=”NumDisks”;E={@($_.Guest.Disk.Length)}} | Sort-Object -Descending NumDisks

ForEach ($VM in $SortedVMs){
$Details = New-object PSObject
$Details | Add-Member -Name Name -Value $VM.name -Membertype NoteProperty
$DiskNum = 0
Foreach ($disk in $VM.Guest.Disk){
$Details | Add-Member -Name “Disk$($DiskNum)path” -MemberType NoteProperty -Value $Disk.DiskPath
$Details | Add-Member -Name “Disk$($DiskNum)Capacity(MB)” -MemberType NoteProperty -Value ([math]::Round($disk.Capacity/ 1MB))
$Details | Add-Member -Name “Disk$($DiskNum)FreeSpace(MB)” -MemberType NoteProperty -Value ([math]::Round($disk.FreeSpace / 1MB))
$DiskNum++
}
$MyCollection += $Details
}

$OutputFileName = Read-Host ‘Enter filename including extension (.csv)’
$MyCollection | Export-Csv $env:USERPROFILE\Documents\$OutputFileName

Write-Host “File has been saved to” $env:USERPROFILE\Documents\$OutputFileName

explorer.exe $env:USERPROFILE\Documents\$OutputFileName

# Out-GridView, Export-Csv, ConvertTo-Html or ConvertTo-Xml can be used above instead

 


2302, 2016

How to Install and config Ansible on CentOS 7.

By |February 23rd, 2016|Categories: Uncategorized|Tags: , , , , , |

In preparation for my lab and openstack testing. I wanted to look at implementing a automation tool. I decided on ansible, as I haven’t used it, and I like a challenge. 🙂

What is ansible?

I turn to Wikipedia.

Ansible (software)

From Wikipedia, the free encyclopedia

 

Ansible, a free-software platform for configuring and managing computers, combines multi-node software deployment, ad hoc task execution, and configuration management.[1] It manages nodes (which must have Python 2.4 or later installed on them) over SSH or over PowerShell.[2] Modules work over JSON and standard output and can be written in any programming language. The system uses YAML to express reusable descriptions of systems.[3]

Michael DeHaan, the author of the provisioning server application Cobbler and co-author of the Func framework for remote administration, developed the platform.[4] It is included as part of the Fedora distribution of Linux, owned by Red Hat Inc., and is also available for Red Hat Enterprise Linux, CentOS, and Scientific Linux via Extra Packages for Enterprise Linux (EPEL) as well as for other operating systems.[5] Ansible, Inc commercially supports and sponsors Ansible[6] On 16 October, 2015, Red Hat Inc. announced that it had signed a definitive agreement to acquire Ansible, Inc.[7][8]

The name “Ansible” references the fictional instantaneous hyperspace communication system (featured in Orson Scott Card‘s Ender’s Game,[9] and originally invented by Ursula K. Le Guin for her 1966 novel Rocannon’s World).”

 

 

After some research on how to install Ansible on Centos 7, I found this write up quite detailed.

 

Ansible is a free & open source Configuration and automation tool for UNIX like operating system. It is written in python and similar to Chef or Puppet but there is one difference and advantage of Ansible is that we don’t need to install any agent on the nodes. It uses SSH for making communication to its nodes.

In this article we will install and configure Ansible in CentOS 7 and will try to manage its two nodes.”

http://www.linuxtechi.com/install-and-use-ansible-in-centos-7/

 

So lets do it!

 

#1 will be putty term 1, #2 will be putty term 2.

 

  • First I like nano, #1 yum install nano -y
  • Connect with putty to the host #1
  • #1 rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
  • #1 yum install ansible -y
  • #1 ansible –version
  • #1 ssh-keygen

ssh gen

  • #1 ssh-copy-id -i [email protected] , then type yes, and type the password for root.

copyssh

  • #1 nano /etc/ansible/hosts
  • add this at the bottom. I am calling this openstack servers.

[openstackservers]

192.168.50.200

192.168.50.201

192.168.50.202

192.168.50.203

192.168.50.204

192.168.50.205

192.168.50.206

 

  • alt x to save, y enter.
  • #1 cat /etc/ansible/hosts

openstackservers

 

  • #1 ansible -m ping 'openstackservers'
  • pingpong

 

  • Sweet. Now let’s have some fun. First I like to watch my work. Lets logs our progress in a new putty session. once your connected lets create some new directories.
  • #2 mkdir /anisble/
  • #2 mkdir /anisble/logs
  • now lets go back to the first putty session. and do the following.
  • #1 anisble -m command -a “who” ‘openstackservers’ >> /anisble/logs.log
  • then lets go back to term 2
  • #2 tail -f /anisble/logs.log
  • This will allow us to see the results on term #2 without losing our commands on term #1. lets check for updates.
  • #1 anisble -m command -a “update -y” ‘openstackservers’ >> /anisble/logs.log
  • in term #2 you will see the following.

updates

 

We are all done! See future posts about way’s to use anisble.

 

Roger Lund