Ronin Windows write powershell script to create facts based off of env variables
Categories
(Infrastructure & Operations :: RelOps: Puppet, task)
Tracking
(Not tracked)
People
(Reporter: markco, Assigned: markco)
References
Details
| Assignee | ||
Comment 1•7 years ago
|
||
By default facter does not create facts based off of environment variables. The main reason this is useful is that will avoid hard coding to a drive letter or directory.
https://github.com/markcor/ronin-win-base/blob/master/site/shared/facts.d/win_env_fact.ps1
Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Creates useful facts based off of system environment variables
$programdata = $env:programdata.replace("","\")
$programfiles = $env:ProgramW6432.replace("","\")
$programfilesx86 = "$env:ProgramFiles(x86)".replace("","\")
Environment variables
write-host "systemdrive=$env:systemdrive\"
write-host "programdata=$programdata\"
write-host "programfiles=$programfiles\"
write-host "programfilesx86=$programfilesx86\"
Facts built off of environment variables
write-host "roninprogramdata=$programdata\PuppetLabs\ronin"
write-host "roninsemaphoredir=$programdata\PuppetLabs\ronin\semaphore"
write-host "tempdir=$env:systemdrive\Windows\Temp"
Description
•