gogetit 0.15.2 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8df3851228231fb78944cfc6bd359085e06b543a8e8aa2635d805200b3431af0
4
- data.tar.gz: 405754156d02512f66b46f29816a318c7fd408b4d82a323c7c1173142470d85b
3
+ metadata.gz: 8907083242126e73dddd139d9e763457cf37a6b6bcc4dd571b405ff70e1e9052
4
+ data.tar.gz: a15dd0a170a63825fe70e5677719f2bb6b2cae5b90d520a14ab8687acac2b5ab
5
5
  SHA512:
6
- metadata.gz: e899cfdce09867e0ee0c6f18cce4462b048638aa89d22f91f69f317c14ac65919224a08d4487a8e79fd6f9c0533508864d2f7d387aae9ef7f6f33dc7f2aa3942
7
- data.tar.gz: 47b1ca4e2f0d0452de15f5b9308c3ef099289d482a00b519343a42c268e6832f2f45e99362f49785acae589d56b2571c0d6c8726f2a2eb67020cc176805133c4
6
+ metadata.gz: afb2d8cb2b3ac18f07cdedc8bacb1177e7fdc83e37bea752c6a042492dd147d40d6c98ad5555d2c466b48761c4aa9d37f519497237395d47cc5f621c56851c5b
7
+ data.tar.gz: 95b329fd114ec4623be32d2eaa916e5ceebd42155d99a9a2ee0e1ee9292d5f5a6339709660967092320158e236817c3e2ed7405cd80c1a1061485bde5ca68df9
data/README.md CHANGED
@@ -74,6 +74,9 @@ gogetit deploy kvm01 -d centos
74
74
  gogetit create lxd01 --no-maas -f lxd_without_maas.yml
75
75
  gogetit create lxd01 --no-maas -f lxd_without_maas_vlans.yml
76
76
 
77
+ # to install MAAS on a lxc container using 'no-maas' option
78
+ gogetit create lxd01 --no-maas -f lxd_without_maas_vlans.yml --maas-on-lxc
79
+
77
80
  gogetit destroy lxd01
78
81
 
79
82
  # This feature is broken and might be deprecated in the future.
@@ -69,6 +69,9 @@ module Gogetit
69
69
  :desc => 'A list of static IPs to assign'
70
70
  method_option :"no-maas", :type => :boolean, \
71
71
  :desc => 'Without MAAS awareness(only for LXD provider)'
72
+ method_option :"maas-on-lxc", :type => :boolean, \
73
+ :desc => 'To install MAAS on a LXC enabling necessary user config'\
74
+ '(only for LXD provider with no-maas enabled)'
72
75
  method_option :"file", :aliases => '-f', :type => :string, \
73
76
  :desc => 'File location(only for LXD provider)'
74
77
  def create(name)
@@ -84,6 +87,9 @@ module Gogetit
84
87
  abort("'no-maas' and 'file' have to be set together.") \
85
88
  if options['no-maas'] ^ !!options['file']
86
89
 
90
+ abort("'maas-on-lxc' and 'no-maas' have to be set together.") \
91
+ if options['maas-on-lxc'] ^ !!options['no-maas']
92
+
87
93
  abort("'distro' has to be set with libvirt provider.") \
88
94
  if options['distro'] and options['provider'] == 'lxd'
89
95
 
@@ -1,3 +1,3 @@
1
1
  module Gogetit
2
- VERSION = "0.15.2"
2
+ VERSION = "0.16.0"
3
3
  end
@@ -53,6 +53,9 @@ module Gogetit
53
53
 
54
54
  if options['no-maas']
55
55
  args[:config][:"user.user-data"] = {}
56
+ if options['maas-on-lxc']
57
+ args[:config][:"security.privileged"] = "true"
58
+ end
56
59
  else
57
60
  sshkeys = maas.get_sshkeys
58
61
  pkg_repos = maas.get_package_repos
@@ -80,7 +83,7 @@ module Gogetit
80
83
  args[:config][:'user.user-data']['package_update'] = false
81
84
  args[:config][:'user.user-data']['package_upgrade'] = false
82
85
 
83
- generate_cloud_init_config(config, args)
86
+ generate_cloud_init_config(options, config, args)
84
87
 
85
88
  args[:config][:"user.user-data"] = \
86
89
  "#cloud-config\n" + YAML.dump(args[:config][:"user.user-data"])[4..-1]
@@ -88,11 +91,18 @@ module Gogetit
88
91
  return args
89
92
  end
90
93
 
91
- def generate_cloud_init_config(config, args)
94
+ def generate_cloud_init_config(options, config, args)
92
95
  logger.info("Calling <#{__method__.to_s}>")
96
+ if options['no-maas']
97
+ # When there is no MAAS, containers should be able to resolve
98
+ # their name with hosts file.
99
+ args[:config][:'user.user-data']['manage_etc_hosts'] = true
100
+ end
101
+
93
102
  # To add truested root CA certificates
94
103
  # https://cloudinit.readthedocs.io/en/latest/topics/examples.html
95
104
  # #configure-an-instances-trusted-ca-certificates
105
+ #
96
106
  if config[:cloud_init] && config[:cloud_init][:ca_certs]
97
107
  args[:config][:'user.user-data']['ca-certs'] = {}
98
108
  certs = []
@@ -400,7 +410,15 @@ echo \"RevokedKeys #{config[:cloud_init][:ssh_ca_public_key][:revocation_path]}\
400
410
 
401
411
  container.devices = args[:devices].merge!(container.devices.to_hash)
402
412
 
403
- require 'pry'; binding.pry
413
+ # https://github.com/jeffshantz/hyperkit/blob/master/lib/hyperkit/client/containers.rb#L240
414
+ # Adding configurations that are necessary for shipping MAAS on lxc
415
+ if options['no-maas'] and options['maas-on-lxc']
416
+ container.config = container.config.to_hash
417
+ container.config[:"raw.lxc"] = "\
418
+ lxc.cgroup.devices.allow = c 10:237 rwm\n\
419
+ lxc.aa_profile = unconfined\n\
420
+ lxc.cgroup.devices.allow = b 7:* rwm"
421
+ end
404
422
 
405
423
  conn.update_container(name, container)
406
424
  # Fetch container object again
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gogetit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.2
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Don Draper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-16 00:00:00.000000000 Z
11
+ date: 2018-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler