Created
July 24, 2015 16:14
-
-
Save rockpapergoat/20956d210060491a495e 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
begin | |
Facter.puppet_classes | |
rescue | |
Facter.loadfacts() | |
end | |
Facter.add("hostname_base") do | |
setcode do | |
Facter.value("hostname").gsub(/\d+$/, "") | |
end | |
end | |
if Facter.value("puppet_classes").nil? | |
#done | |
else | |
hostname = Facter.value("hostname") | |
puppet_classes = Facter.value("puppet_classes") | |
access = {"access" => ["profiles::access", "profiles::node_type::access", "profiles::access::rclogin"]} | |
def parse_classes(type,classes) | |
res = "#{type.values.any? { |klass| classes.include?(klass)} ? 'true' : 'false'}" | |
return res | |
end | |
#puts parse_classes(access,puppet_classes) | |
Facter.add("access_node") do | |
setcode do | |
access_node = parse_classes(access,puppet_classes) | |
end | |
access_node | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment