Module: ChefUtils::DSL::Cloud

Extended by:
Cloud
Includes:
Internal
Included in:
ChefUtils, Cloud
Defined in:
lib/chef-utils/dsl/cloud.rb

Instance Method Summary collapse

Instance Method Details

#alibaba?(node = __getnode) ⇒ Boolean

Determine if the current node is running in Alibaba Cloud

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

  • (Boolean)

Since:

  • 17.0



45
46
47
# File 'lib/chef-utils/dsl/cloud.rb', line 45

def alibaba?(node = __getnode)
  node.key?("alibaba")
end

#azure?(node = __getnode) ⇒ Boolean

Determine if the current node is running in Microsoft Azure.

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

  • (Boolean)

Since:

  • 15.8



124
125
126
# File 'lib/chef-utils/dsl/cloud.rb', line 124

def azure?(node = __getnode)
  node.key?("azure")
end

#cloud?(node = __getnode) ⇒ Boolean

Determine if the current node is running in a known cloud.

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

  • (Boolean)

Since:

  • 15.8



33
34
35
36
# File 'lib/chef-utils/dsl/cloud.rb', line 33

def cloud?(node = __getnode)
  # cloud is always present, but nil if not on a cloud
  !node["cloud"].nil?
end

#digital_ocean?(node = __getnode) ⇒ Boolean Also known as: digitalocean?

Determine if the current node is running in DigitalOcean.

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

  • (Boolean)

Since:

  • 15.8



135
136
137
# File 'lib/chef-utils/dsl/cloud.rb', line 135

def digital_ocean?(node = __getnode)
  node.key?("digital_ocean")
end

#ec2?(node = __getnode) ⇒ Boolean

Determine if the current node is running in AWS EC2.

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

  • (Boolean)

Since:

  • 15.8



56
57
58
# File 'lib/chef-utils/dsl/cloud.rb', line 56

def ec2?(node = __getnode)
  node.key?("ec2")
end

#eucalyptus?(node = __getnode) ⇒ Boolean Also known as: euca?

Determine if the current node is running in Eucalyptus.

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

  • (Boolean)

Since:

  • 15.8



89
90
91
# File 'lib/chef-utils/dsl/cloud.rb', line 89

def eucalyptus?(node = __getnode)
  node.key?("eucalyptus")
end

#gce?(node = __getnode) ⇒ Boolean

Determine if the current node running in Google Compute Engine (GCE).

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

  • (Boolean)

Since:

  • 15.8



67
68
69
# File 'lib/chef-utils/dsl/cloud.rb', line 67

def gce?(node = __getnode)
  node.key?("gce")
end

#linode?(node = __getnode) ⇒ Boolean

Determine if the current node is running in Linode.

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

  • (Boolean)

Since:

  • 15.8



102
103
104
# File 'lib/chef-utils/dsl/cloud.rb', line 102

def linode?(node = __getnode)
  node.key?("linode")
end

#openstack?(node = __getnode) ⇒ Boolean

Determine if the current node is running in OpenStack.

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

  • (Boolean)

Since:

  • 15.8



113
114
115
# File 'lib/chef-utils/dsl/cloud.rb', line 113

def openstack?(node = __getnode)
  node.key?("openstack")
end

#rackspace?(node = __getnode) ⇒ Boolean

Determine if the current node is running in Rackspace.

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

  • (Boolean)

Since:

  • 15.8



78
79
80
# File 'lib/chef-utils/dsl/cloud.rb', line 78

def rackspace?(node = __getnode)
  node.key?("rackspace")
end

#softlayer?(node = __getnode) ⇒ Boolean

Determine if the current node is running in SoftLayer (IBM Cloud).

Parameters:

  • node (Chef::Node) (defaults to: __getnode)

    the node to check

Returns:

  • (Boolean)

Since:

  • 15.8



148
149
150
# File 'lib/chef-utils/dsl/cloud.rb', line 148

def softlayer?(node = __getnode)
  node.key?("softlayer")
end