digital_ocean_inventory 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/digital_ocean_inventory/collector.rb +9 -39
- data/lib/digital_ocean_inventory/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49db0ef1f05794822bf84ae4c53c758f0850893b75d2532d89a4b8ded7473989
|
4
|
+
data.tar.gz: 9e1437fd9c2e26f89cd63d111b497445012bfaa7a55d3055f3132804400ee66c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fe746fd14107495635530b15d74995dcf8454e4adebade5d792bea4666983adbd9853ab73cdc8e71ba6a0c7943ac4f7da5437ad4c802acd2b6fde3a136594f5
|
7
|
+
data.tar.gz: 6a113ae4b7f19e8994619563077dc7b3b687d8007c05e3e55275aad672420c31e2f0a1bba0558469b64526ce120a28751fab96a6b372fc94c3b99e2bca9814eb
|
@@ -50,10 +50,8 @@ module DigitalOceanInventory
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def select_droplet?(droplet)
|
53
|
-
return true if config.select_tags.empty?
|
54
|
-
|
55
53
|
tags = droplet.tags || []
|
56
|
-
|
54
|
+
tags.any? { _1 == "ansible:enable" }
|
57
55
|
end
|
58
56
|
|
59
57
|
def ignore_droplet?(droplet)
|
@@ -71,10 +69,16 @@ module DigitalOceanInventory
|
|
71
69
|
end
|
72
70
|
|
73
71
|
def droplet_groups(droplet)
|
74
|
-
groups = []
|
72
|
+
groups = %w[digitalocean]
|
75
73
|
groups << droplet.region.slug if config.group_by_region
|
76
74
|
groups << droplet_vpc(droplet)
|
77
|
-
|
75
|
+
|
76
|
+
droplet.tags
|
77
|
+
&.uniq
|
78
|
+
&.select { |t| t.match? /^ansible:g:/ }
|
79
|
+
&.map { |t| t.gsub "ansible:g:", "" }
|
80
|
+
&.each { |t| groups << t }
|
81
|
+
|
78
82
|
groups.uniq.map { |g| g.gsub('-', '_') }
|
79
83
|
end
|
80
84
|
|
@@ -83,39 +87,5 @@ module DigitalOceanInventory
|
|
83
87
|
vpc = config.client.vpcs.find id: id
|
84
88
|
vpc.name
|
85
89
|
end
|
86
|
-
# def add_droplets
|
87
|
-
# project_droplets.each do |droplet|
|
88
|
-
# name = droplet.name
|
89
|
-
# groups = ["digitalocean"]
|
90
|
-
|
91
|
-
# if droplet.region.name.include? "nyc"
|
92
|
-
# groups << "usa"
|
93
|
-
# groups << "nyc"
|
94
|
-
# elsif droplet.region.name.include? "sfo"
|
95
|
-
# groups << "usa"
|
96
|
-
# groups << "sfo"
|
97
|
-
# end
|
98
|
-
|
99
|
-
# tags = droplet.tags || []
|
100
|
-
# groups = groups.concat tags
|
101
|
-
|
102
|
-
# groups << droplet.image.distribution.downcase
|
103
|
-
# # groups << droplet.image.name
|
104
|
-
|
105
|
-
# public_net = droplet.networks.v4.find { |n| n.type == "public" }
|
106
|
-
# private_net = droplet.networks.v4.find { |n| n.type == "private" }
|
107
|
-
|
108
|
-
# inventory.host name, groups: groups, vars: dns_results[:vars].merge({
|
109
|
-
# public_ip: public_net.ip_address,
|
110
|
-
# private_ip: private_net.ip_address,
|
111
|
-
# droplet_id: droplet.id,
|
112
|
-
# vpc_uuid: droplet.vpc_uuid,
|
113
|
-
# digitalocean_tags: tags,
|
114
|
-
# internal_dns_records: dns_results[:dns]
|
115
|
-
# })
|
116
|
-
# end
|
117
|
-
# end
|
118
|
-
|
119
|
-
|
120
90
|
end
|
121
91
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: digital_ocean_inventory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Hurst
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: droplet_kit
|