Created
August 31, 2016 17:58
-
-
Save tas50/afc85f1988c5723b3af9c9e74f117084 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| Ohai.plugin(:Acme) do | |
| provides 'acme' | |
| depends 'hostname' | |
| collect_data(:linux, :darwin, :freebsd) do | |
| acme Mash.new | |
| if fqdn.to_s.downcase.include?('acme.net') | |
| # extract just the datacenter portion using our standard linux naming schema of vps-123.POP.acme.net. Handle PHX2 -> PHX also | |
| acme[:pop] = fqdn.split('.')[-3].gsub(/[0-9]/, '').upcase | |
| end | |
| end | |
| collect_data(:windows) do | |
| acme Mash.new | |
| # extract just the datacenter portion using our standard windows naming schema of vps-123-POP.acme.net. Handle PHX2 -> PHX also | |
| acme[:pop] = fqdn.split('.')[-3].split('-')[-1].gsub(/[0-9]/, '').upcase | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment