Supriya Uppalapati
2014-Jun-26 14:46 UTC
[Puppet Users] how to create custom application facts
Hi I am trying to create custom application facts to create hierarchy for
my environment
database
│ └── testing
│ ├── default.yaml
│ └── dot-idb-spr-t01.ddc.dot.state.ma.us.yaml
├── defaults.yaml
├── global.yaml
├── hp-extreme
│ ├── dev
│ ├── dev1
│ ├── dev2
│ ├── dev3
│ ├── patch
│ ├── pristine
│ ├── test
│ ├── test1
│ ├── test2
│ ├── test3
│ └── training
├── ibm_id
│ ├── dev
│ ├── dev1
│ ├── dev2
│ └── dev3
├── ibm_rational
├── informatica
│ ├── dev
│ ├── dev1
│ ├── dev2
│ ├── dev3
│ ├── patch
│ ├── pristine
│ ├── test
│ ├── test1
│ ├── test2
│ ├── test3
│ └── training
├── keys
│ ├── private_key.pkcs7.pem
│ └── public_key.pkcs7.pem
├── oracle
│ ├── dev
│ │ ├── default.yaml
│ │ └── rmv-pap-spr-d01.dot.state.ma.us.yaml
│ ├── dev1
│ ├── dev2
│ ├── dev3
│ ├── patch
│ ├── pristine
│ ├── test1
│ ├── test2
│ ├── test3
│ ├── testing
│ │ ├── default.yaml
│ │ ├── dot-fap-spr-t01.local.yaml_backup1
│ │ ├── dot-wap-spr-t03.local.yaml
│ │ └── puppet-admin.rmv-map-spr-t05.dot.state.ma.us.yaml
│ └── training
├── puppet
│ └── development
│ ├── default.yaml
│ ├── dot-pap-spr-d01.local.yaml
│ ├── dot-pap-spr-d03.local.yaml
│ └── dot-pdb-spr-d02.local.yaml
└── testing
└── dot-fap-spr-t01.local
According to this I wrote a custom facts. but it is not working help me
more application_type.rb
require 'rexml/document'
require 'facter'
Facter.add(:application_type) do
confine :hostname => 'hostname'
setcode do
application_installed = Facter::Core::Execution.exec('hostname -f')
if application_installed == "/f/e/w/x/b/o/"
print "oracle"
elsif application_installed == "db"
print "database"
elsif application_installed == "/r/i/"
print "ibm"
elsif application_installed == "/a/q/"
print "informatica"
else
print "puppet"
end
end
end
I am trying to identify application type based on hostname.
Please help me
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/2b814289-6e84-45ef-bcca-b7f5984b1445%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.