Format and Syntax cleanup

this commit fixes a significant number of syntax errors and code
formatting issues that were reported by puppet-lint.
Correct variable scope in templates

templates should pull in variables using the correct scope see:

http://docs.puppetlabs.com/guides/templating.html#referencing-variables

for details
Fix incorrect array iterators

@mcanevet quite rightly pointed out these corrected issues... Strangely they
did't fail an erb syntax check.
Merge pull request #38 from sfozz/issue/lint

syntax and formatting cleanup