I'm creating a puppet manifest and I'm trying to use a built in facter variable based on the MAC model. I'm using this guide: https://docs.puppetlabs.com/facter/3.1/core_facts.html
I saw system_profiler
with an option for model_identifier
but I'm not sure what the correct syntax is.
Here is where I'm confused:
class::something::mac
if $<% system_profiler %> eq "macpro"; then
do the thing
else
don't do the thing
Where/how do I actually use model_identifier? I'm new to puppet and MAC so any advice would be great!
My current facter version v2.4 doesn't support it, but I can't successfully install latest facter v3.1.4, so can't test the code. It should be closed for your question.
if $::system_profiler::model_identifier == "MacBookPro10,2" {
do the thing
}
else {
don't do the thing
}
Run the command on your mac to prove it.
$ system_profiler SPHardwareDataType
Hardware:
Hardware Overview:
Model Name: MacBook Pro
Model Identifier: MacBookPro10,2
Related codes at:
+ { "Model Identifier", [](data& d) -> string& { return d.model_identifier; } },
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.