diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ohai/plugins/azure.rb | 13 | ||||
-rw-r--r-- | lib/ohai/plugins/cloud.rb | 29 |
2 files changed, 42 insertions, 0 deletions
diff --git a/lib/ohai/plugins/azure.rb b/lib/ohai/plugins/azure.rb new file mode 100644 index 00000000..d13a388f --- /dev/null +++ b/lib/ohai/plugins/azure.rb @@ -0,0 +1,13 @@ + +provides "azure" + + +azure_metadata_from_hints = hint?('azure') +if azure_metadata_from_hints + Ohai::Log.debug("azure_metadata_from_hints is present.") + azure Mash.new + azure_metadata_from_hints.each {|k, v| azure[k] = v } +else + Ohai::Log.debug("No hints present for azure.") + false +end
\ No newline at end of file diff --git a/lib/ohai/plugins/cloud.rb b/lib/ohai/plugins/cloud.rb index 68852d04..0d5e9273 100644 --- a/lib/ohai/plugins/cloud.rb +++ b/lib/ohai/plugins/cloud.rb @@ -22,6 +22,7 @@ require_plugin "rackspace" require_plugin "eucalyptus" require_plugin "linode" require_plugin "openstack" +require_plugin "azure" # Make top-level cloud hashes # @@ -215,3 +216,31 @@ if on_openstack? create_objects get_openstack_values end + +# ---------------------------------------- +# azure +# ---------------------------------------- + +# Is current cloud azure? +# +# === Return +# true:: If azure Hash is defined +# false:: Otherwise +def on_azure? + azure != nil +end + +# Fill cloud hash with azure values +def get_azure_values + cloud[:public_ip] = azure['public_ip'] + cloud[:public_hostname] = azure['public_hostname'] + cloud[:public_ssh_port] = azure['public_ssh_port'] if azure['public_ssh_port'] + cloud[:public_winrm_port] = azure['public_winrm_port'] if azure['public_winrm_port'] + cloud[:provider] = "azure" +end + +# setup azure cloud data +if on_azure? + create_objects + get_azure_values +end
\ No newline at end of file |