Last active
April 25, 2016 18:21
-
-
Save glarizza/1416a84e4cc79c3329d317da774c312c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dell_region = case real_domain | |
when /^(aus).dell.com/ | |
'AMER' | |
when /^(lon).dell.com/ | |
'EMEA' | |
else | |
'UNKNOWN' | |
end | |
Facter.add('dell_location') do | |
confine :kernel => :linux | |
setcode do | |
## Logic to pull from dell.cfg | |
end | |
end | |
Facter.add('dell_location') do | |
confine :kernel => :windows | |
setcode do | |
## Logic to pull from Registry | |
end | |
end | |
Facter.add('dell_combined') do | |
case Facter.value(:kernel) | |
when 'Linux' | |
# Do Linux logic here | |
some_var = do_linux_lookup('foo') | |
when 'windows' | |
# Do Windows logic here | |
some_var = do_windows_lookup('foo') | |
end | |
setcode do | |
# Use the variable above and set the fact | |
end | |
end | |
Facter.add('dell_region') do | |
confine :kernel => :linux | |
setcode do | |
# Get location from Fact | |
location = Facter.value(:location) | |
# Now do things... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment