avst-cloud 0.1.40 → 0.1.41
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/.travis.yml +1 -1
- data/avst-cloud.gemspec +3 -3
- data/lib/avst-cloud/aws_connection.rb +49 -17
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 733f10630f58e2081f47fd017b462c8a150b37e1009cd2c0557bbcce5dc061a9
|
|
4
|
+
data.tar.gz: 6fd8942f5dbd0e83482966ed4f96ed76dbe959ac5391c656e577f1cf1f3503b6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4fe6c7b1260da9a622621e871936d79bc468e256e61ec29d760028eb47624ccf2d5a859c93a3998c2bae6957af9e13e8547c57e8dac5915b1a91ccec4ad40fca
|
|
7
|
+
data.tar.gz: def1c8d32b83f8f693fa5b82583eb165190801c6f48b1867dd3212e6ae4ed05feb043d267675d882e227e66421c04a7223040f3c5af0efc462a8f417d9b35e9c
|
data/.travis.yml
CHANGED
|
@@ -2,7 +2,7 @@ language: ruby
|
|
|
2
2
|
before_install:
|
|
3
3
|
# https://github.com/travis-ci/travis-rubies/issues/57#issuecomment-458981237
|
|
4
4
|
- "find /home/travis/.rvm/rubies -wholename '*default/bundler-*.gemspec' -delete"
|
|
5
|
-
- gem install bundler --version
|
|
5
|
+
- gem install bundler --version 2.2.10
|
|
6
6
|
notifications:
|
|
7
7
|
email: false
|
|
8
8
|
hipchat:
|
data/avst-cloud.gemspec
CHANGED
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "avst-cloud"
|
|
7
|
-
spec.version = '0.1.
|
|
7
|
+
spec.version = '0.1.41'
|
|
8
8
|
spec.authors = ["Martin Brehovsky", "Jon Bevan", "Matthew Hope"]
|
|
9
9
|
spec.email = ["mbrehovsky@adaptavist.com", "jbevan@adaptavist.com", "mhope@adaptavist.com"]
|
|
10
10
|
spec.summary = %q{Automated creation, bootstrapping and provisioning of servers }
|
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
|
15
15
|
spec.executables = ["avst-cloud", "avst-cloud-puppet", "avst-cloud-rackspace", "avst-cloud-azure", "avst-cloud-azure-rm"]
|
|
16
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
17
17
|
spec.require_paths = ["lib"]
|
|
18
|
-
spec.add_development_dependency "bundler", "
|
|
18
|
+
spec.add_development_dependency "bundler", "2.2.10"
|
|
19
19
|
spec.add_development_dependency "rake"
|
|
20
20
|
spec.add_dependency "fog"
|
|
21
21
|
spec.add_dependency "fog-core", "1.43.0"
|
|
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
spec.add_dependency "derelict"
|
|
32
32
|
spec.add_dependency "docopt", ">= 0.5.0"
|
|
33
33
|
spec.add_dependency "rainbow", '3.0.0'
|
|
34
|
-
spec.add_dependency "nokogiri", "~> 1.8
|
|
34
|
+
spec.add_dependency "nokogiri", "~> 1.10.8"
|
|
35
35
|
spec.add_dependency "signet", "0.14.1"
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -33,7 +33,7 @@ module AvstCloud
|
|
|
33
33
|
AvstCloud::AwsServer.new(server, server_name, server.public_ip_address, root_user, root_password)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
def create_server(server_name, flavour, os, key_name, ssh_key, subnet_id, security_group_ids, ebs_size, hdd_device_path, ami_image_id, availability_zone, additional_hdds={}, vpc=nil, created_by=nil, custom_tags={}, root_username=nil, create_elastic_ip=false, encrypt_root=false ,root_encryption_key=nil, delete_root_disk=true, root_disk_type='gp2', root_disk_iops=0, private_ip=nil)
|
|
36
|
+
def create_server(server_name, flavour, os, key_name, ssh_key, subnet_id, security_group_ids, ebs_size, hdd_device_path, ami_image_id, availability_zone, additional_hdds={}, vpc=nil, created_by=nil, custom_tags={}, root_username=nil, create_elastic_ip=false, encrypt_root=false ,root_encryption_key=nil, delete_root_disk=true, root_disk_type='gp2', root_disk_iops=0, private_ip=nil, public_ip=nil)
|
|
37
37
|
# Permit named instances from DEFAULT_FLAVOURS
|
|
38
38
|
flavour = flavour || "t2.micro"
|
|
39
39
|
os = os || "ubuntu-14"
|
|
@@ -90,6 +90,31 @@ module AvstCloud
|
|
|
90
90
|
logger.debug "create_elastic_ip - #{create_elastic_ip}"
|
|
91
91
|
logger.debug "custom_private_ip - #{private_ip}"
|
|
92
92
|
|
|
93
|
+
elastic_ip_address = nil
|
|
94
|
+
|
|
95
|
+
# if a public IP has been specified, try to lookup the elastic IP and use it
|
|
96
|
+
if public_ip
|
|
97
|
+
require "resolv"
|
|
98
|
+
# we can find IP based on either its address or its Name tag, if the provided value is not an IP try by tag
|
|
99
|
+
if public_ip =~ Resolv::IPv4::Regex
|
|
100
|
+
found_eip = connect.describe_addresses('public-ip' => [public_ip])
|
|
101
|
+
else
|
|
102
|
+
found_eip = connect.describe_addresses('tag:Name' => [public_ip])
|
|
103
|
+
end
|
|
104
|
+
if ! found_eip.data[:body]['addressesSet'][0].nil?
|
|
105
|
+
# if we have found the IP and its not already associated use it
|
|
106
|
+
if found_eip.data[:body]['addressesSet'][0]['publicIp'] and ! found_eip.data[:body]['addressesSet'][0]['associationId']
|
|
107
|
+
elastic_ip =found_eip.data[:body]['addressesSet'][0]
|
|
108
|
+
elastic_ip_address = elastic_ip['publicIp']
|
|
109
|
+
logger.debug "Requested Elastic IP found and is unallocated, an attempt to attach this to the VM will be made"
|
|
110
|
+
else
|
|
111
|
+
logger.warn "Requested Elastic IP exist but is already allocated, the system will be created but will NOT use this IP"
|
|
112
|
+
end
|
|
113
|
+
else
|
|
114
|
+
logger.warn "Requested Elastic IP does not exist, the system will be created but will NOT use this IP"
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
93
118
|
create_ebs_volume = nil
|
|
94
119
|
if ebs_size
|
|
95
120
|
# in case of centos ami we need to use /dev/xvda this is ami dependent
|
|
@@ -181,26 +206,33 @@ module AvstCloud
|
|
|
181
206
|
logger.debug "[DONE]\n\n"
|
|
182
207
|
|
|
183
208
|
# create Elastic IP Address if required
|
|
184
|
-
if create_elastic_ip
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
logger.debug ("Elastic IP #{elastic_ip_address} created, attempting to allocate to server")
|
|
191
|
-
connect.associate_address(server.id, elastic_ip_address)
|
|
192
|
-
# reacquire server object as IP has, probably, changed
|
|
193
|
-
server = find_fog_server(server_name)
|
|
194
|
-
|
|
195
|
-
# create tag on the Elastic IP
|
|
196
|
-
# TODO: add ability for other tags to be defined by the user
|
|
197
|
-
logger.debug("Creating tags on Elastic IP Address #{elastic_ip}\n\n")
|
|
198
|
-
connect.tags.create(:resource_id => elastic_ip['allocationId'], :key => "Name", :value => server_name)
|
|
209
|
+
if create_elastic_ip
|
|
210
|
+
if elastic_ip_address.nil?
|
|
211
|
+
logger.debug("Attempting to create elastic IP address")
|
|
212
|
+
elastic_ip = connect.allocate_address("vpc").body
|
|
213
|
+
elastic_ip_address = elastic_ip['publicIp']
|
|
214
|
+
logger.warn "Elastic IP creation failed, proceeding with non Elastic IP\n\n" if ! elastic_ip_address
|
|
199
215
|
else
|
|
200
|
-
logger.warn
|
|
216
|
+
logger.warn "You have asked to create an Elastic IP and ALSO use an existing one"
|
|
217
|
+
logger.warn "The existing IP is avaliable and as such will be used INSTEAD of creating a new one!"
|
|
201
218
|
end
|
|
202
219
|
end
|
|
203
220
|
|
|
221
|
+
# if we have a server id and an Elastic public IP attempt to join the two togehter
|
|
222
|
+
if server.id and elastic_ip_address
|
|
223
|
+
logger.debug ("Attempting to allocate Elastic IP #{elastic_ip_address} to server")
|
|
224
|
+
connect.associate_address(server.id, elastic_ip_address)
|
|
225
|
+
# reacquire server object as IP has, probably, changed
|
|
226
|
+
server = find_fog_server(server_name)
|
|
227
|
+
|
|
228
|
+
# create tag on the Elastic IP
|
|
229
|
+
# TODO: add ability for other tags to be defined by the user
|
|
230
|
+
logger.debug("Creating tags on Elastic IP Address #{elastic_ip}\n\n")
|
|
231
|
+
connect.tags.create(:resource_id => elastic_ip['allocationId'], :key => "Name", :value => server_name)
|
|
232
|
+
else
|
|
233
|
+
logger.warn("EAllocation of Elastic IP failed, proceeding with non Elastic IP\n\n")
|
|
234
|
+
end
|
|
235
|
+
|
|
204
236
|
logger.debug "The server has been successfully created, to login onto the server:\n"
|
|
205
237
|
logger.debug "\t ssh -i #{ssh_key} #{root_user}@#{server.public_ip_address}\n"
|
|
206
238
|
if create_ebs_volume
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: avst-cloud
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.41
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martin Brehovsky
|
|
@@ -10,22 +10,22 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2021-
|
|
13
|
+
date: 2021-05-25 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: bundler
|
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
|
18
18
|
requirements:
|
|
19
|
-
- -
|
|
19
|
+
- - '='
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version:
|
|
21
|
+
version: 2.2.10
|
|
22
22
|
type: :development
|
|
23
23
|
prerelease: false
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
25
|
requirements:
|
|
26
|
-
- -
|
|
26
|
+
- - '='
|
|
27
27
|
- !ruby/object:Gem::Version
|
|
28
|
-
version:
|
|
28
|
+
version: 2.2.10
|
|
29
29
|
- !ruby/object:Gem::Dependency
|
|
30
30
|
name: rake
|
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -200,14 +200,14 @@ dependencies:
|
|
|
200
200
|
requirements:
|
|
201
201
|
- - "~>"
|
|
202
202
|
- !ruby/object:Gem::Version
|
|
203
|
-
version: 1.8
|
|
203
|
+
version: 1.10.8
|
|
204
204
|
type: :runtime
|
|
205
205
|
prerelease: false
|
|
206
206
|
version_requirements: !ruby/object:Gem::Requirement
|
|
207
207
|
requirements:
|
|
208
208
|
- - "~>"
|
|
209
209
|
- !ruby/object:Gem::Version
|
|
210
|
-
version: 1.8
|
|
210
|
+
version: 1.10.8
|
|
211
211
|
- !ruby/object:Gem::Dependency
|
|
212
212
|
name: signet
|
|
213
213
|
requirement: !ruby/object:Gem::Requirement
|