syntax and formatting cleanup

These commits correct a number of syntax and formatting issues that were picked up by puppet-lint. Variables in templates have also been updated to pulled in from the correct scope.