Skip to content

Commit

Permalink
Chef 12 azure rm support (#25)
Browse files Browse the repository at this point in the history
Adding in Azure support in tagging mechanism using failover to cloud_v2, and finally just node['ipaddress']
  • Loading branch information
rshade authored Feb 1, 2017
1 parent 69b6eed commit 93a8e1d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 144 deletions.
2 changes: 1 addition & 1 deletion Berksfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ GRAPH
seven_zip (>= 0.0.0)
ohai (4.2.3)
compat_resource (>= 12.14.7)
rightscale_tag (2.0.0)
rightscale_tag (2.0.1)
machine_tag (~> 2.0)
marker (~> 2.0)
seven_zip (2.0.2)
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ rightscale_tag Cookbook CHANGELOG

This file is used to list changes made in each version of the rightscale_tag cookbook.

v2.0.1
------

- Adding in support for azurerm

v2.0.0
------

Expand Down
140 changes: 0 additions & 140 deletions Gemfile.lock

This file was deleted.

2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license 'Apache 2.0'
description 'Provides LWRPs and helper methods for building 3-tier applications using machine tags in RightScale'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '2.0.0'
version '2.0.1'
issues_url 'https://github.com/rightscale-cookbooks/rightscale_tag/issues'
source_url 'https://github.com/rightscale-cookbooks/rightscale_tag'

Expand Down
21 changes: 19 additions & 2 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,33 @@
machine_tag "server:uuid=#{node['rightscale']['instance_uuid']}"
end

ip_addr = node['ipaddress']
if node['cloud']
if node['cloud']['public_ips']
if node['cloud']['public_ips'] && !node['cloud']['public_ips'].first.nil?
node['cloud']['public_ips'].reject { |ip| ip.nil? || ip.empty? || IPAddress(ip).private? }.each_with_index do |public_ip, index|
machine_tag "server:public_ip_#{index}=#{public_ip}"
end
elsif node['cloud_v2']
if node['cloud_v2']['public_ipv4_addrs']
node['cloud_v2']['public_ipv4_addrs'].reject { |ip| ip.nil? || ip.empty? || IPAddress(ip).private? }.each_with_index do |public_ip, index|
machine_tag "server:public_ip_#{index}=#{public_ip}"
end
end
else
machine_tag "server:public_ip_0=#{ip_addr}" unless IPAddress(ip_addr).private?
end

if node['cloud']['private_ips']
if node['cloud']['private_ips'] && !node['cloud']['private_ips'].first.nil?
node['cloud']['private_ips'].reject { |ip| ip.nil? || ip.empty? || !IPAddress(ip).private? }.each_with_index do |private_ip, index|
machine_tag "server:private_ip_#{index}=#{private_ip}"
end
elsif node['cloud_v2']
if node['cloud_v2']['local_ipv4_addrs']
node['cloud_v2']['local_ipv4_addrs'].reject { |ip| ip.nil? || ip.empty? || !IPAddress(ip).private? }.each_with_index do |private_ip, index|
machine_tag "server:private_ip_#{index}=#{private_ip}"
end
end
elsif IPAddress(ip_addr).private?
machine_tag "server:private_ip_0=#{ip_addr}"
end
end

0 comments on commit 93a8e1d

Please sign in to comment.