vagrant-em-demos 0.1.0

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.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/code/environments/plugin/hiera.yaml +17 -0
  3. data/code/environments/plugin/hieradata/deployment_zones/vagrant.yaml +1 -0
  4. data/code/environments/plugin/hieradata/nodes/puppetserver.yaml +2 -0
  5. data/code/environments/plugin/manifests/site.pp +14 -0
  6. data/code/environments/plugin/modules/profile/manifests/base/config.pp +11 -0
  7. data/code/environments/plugin/modules/profile/manifests/base/hosts.pp +13 -0
  8. data/code/environments/plugin/modules/profile/manifests/base/packages.pp +13 -0
  9. data/code/environments/plugin/modules/profile/manifests/base/vagrant.pp +39 -0
  10. data/code/environments/plugin/modules/profile/manifests/base.pp +8 -0
  11. data/code/environments/plugin/modules/profile/manifests/puppetserver.pp +20 -0
  12. data/code/environments/plugin/modules/role/manifests/puppet_enterprise.pp +1 -0
  13. data/code/environments/plugin/modules/role/manifests/puppetserver.pp +7 -0
  14. data/lib/vagrant/em/demos/Vagrantfile.rb +42 -0
  15. data/lib/vagrant/em/demos/adress_manager.rb +44 -0
  16. data/lib/vagrant/em/demos/command/cleanup.rb +29 -0
  17. data/lib/vagrant/em/demos/command/prepare.rb +35 -0
  18. data/lib/vagrant/em/demos/config.rb +20 -0
  19. data/lib/vagrant/em/demos/config_reader.rb +118 -0
  20. data/lib/vagrant/em/demos/defaults.yaml +54 -0
  21. data/lib/vagrant/em/demos/errors.rb +15 -0
  22. data/lib/vagrant/em/demos/models.rb +97 -0
  23. data/lib/vagrant/em/demos/plugin.rb +40 -0
  24. data/lib/vagrant/em/demos/types/agent.rb +26 -0
  25. data/lib/vagrant/em/demos/types/base.rb +333 -0
  26. data/lib/vagrant/em/demos/types/masterless.rb +37 -0
  27. data/lib/vagrant/em/demos/types/pe_agent.rb +33 -0
  28. data/lib/vagrant/em/demos/types/pe_master.rb +13 -0
  29. data/lib/vagrant/em/demos/types/ps_server.rb +16 -0
  30. data/lib/vagrant/em/demos/version.rb +9 -0
  31. data/lib/vagrant/em/demos.rb +12 -0
  32. data/vm-scripts/install_modules.ps1 +9 -0
  33. data/vm-scripts/install_puppet.ps1 +22 -0
  34. data/vm-scripts/install_puppet.sh +21 -0
  35. data/vm-scripts/install_puppet_agent.sh +17 -0
  36. data/vm-scripts/install_puppet_enterprise.sh +42 -0
  37. data/vm-scripts/install_puppet_server.sh +37 -0
  38. data/vm-scripts/run_puppet.ps1 +2 -0
  39. data/vm-scripts/setup_puppet.ps1 +37 -0
  40. data/vm-scripts/setup_puppet.sh +77 -0
  41. data/vm-scripts/setup_puppet_raw.ps1 +1 -0
  42. metadata +114 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d3b112c514632342110ca68fde78d575498ece865d9b96e3602867c250d7e65f
4
+ data.tar.gz: 403a9897dfd29c47583728699ea664fdfff1ab5bb118e24f092d091ee178b8c3
5
+ SHA512:
6
+ metadata.gz: d517770aab989f68f06f1d964b2a8cc340b80007744daceeba8c899fc53baba911698edcce5851a169b6ddb4fb365f595d902571be3e1805250af338c47247cb
7
+ data.tar.gz: d637dc143dd55fe02fe727b4873a18b0a3827065b22394a92d26615a08fb3103cec562833a24bc1ebc725240ff4c199d95c7276f058918750f12ea7acf4d8aec
@@ -0,0 +1,17 @@
1
+ ---
2
+ version: 5
3
+ defaults: # Used for any hierarchy level that omits these keys.
4
+ datadir: hieradata # This path is relative to hiera.yaml's directory.
5
+ data_hash: yaml_data # Use the built-in YAML backend.
6
+
7
+ hierarchy:
8
+ - name: "Per-node data" # Human-readable name.
9
+ paths:
10
+ - "nodes/%{networking.hostname}.yaml" # File path, relative to datadir.
11
+ - "nodes/%{networking.fqdn}.yaml"
12
+
13
+ - name: "Deployment Zone" # Uses custom facts.
14
+ path: "deployment_zones/%{::deployment_zone}.yaml"
15
+
16
+ - name: "Defaults"
17
+ path: "defaults.yaml"
@@ -0,0 +1 @@
1
+ profile::base::hosts::list: {}
@@ -0,0 +1,2 @@
1
+ ---
2
+ role: role::puppetserver
@@ -0,0 +1,14 @@
1
+ include stdlib # Make sure the standard functions are available
2
+ if defined(easy_type::license::activate) {
3
+ include easy_type::license::activate # Always include the license class. This makes sure all the license files are copied
4
+ }
5
+
6
+ #
7
+ # This is the schedule used for applying patches. The databases and WebLogic instances
8
+ # might go down during these times.
9
+ #
10
+ schedule { 'maintenance-window':
11
+ range => "00:00 - 23:59" # Change to your requirements
12
+ }
13
+
14
+ lookup('role', String).include
@@ -0,0 +1,11 @@
1
+ #
2
+ # This is the base configuration. It is the same for ALL nodes
3
+ #
4
+ class profile::base::config()
5
+ {
6
+ if $::kernel == 'Linux' {
7
+ class { 'timezone':
8
+ timezone => 'Europe/Amsterdam',
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,13 @@
1
+ #
2
+ # Make sure all required nodes are in the hosts file.
3
+ #
4
+ class profile::base::hosts(
5
+ Hash $list,
6
+ )
7
+ {
8
+ $list.each |$host, $values| {
9
+ host { $host:
10
+ * => $values,
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ #
2
+ # Make sure all required packages are installed
3
+ #
4
+ class profile::base::packages()
5
+ {
6
+ $required_package = [
7
+ ]
8
+
9
+ package{ $required_package:
10
+ ensure => 'installed',
11
+ }
12
+
13
+ }
@@ -0,0 +1,39 @@
1
+ # Contains all development specific stuff on vagrant boxes
2
+ class profile::base::vagrant()
3
+ {
4
+
5
+ if $::kernel == 'Linux' {
6
+
7
+ $required_packages = [
8
+ 'mlocate',
9
+ 'unzip',
10
+ ]
11
+
12
+ package{ $required_packages:
13
+ ensure => 'installed',
14
+ }
15
+
16
+ exec { 'create swap file':
17
+ command => '/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=8192',
18
+ creates => '/var/swap.1',
19
+ }
20
+
21
+ -> exec { 'attach swap file':
22
+ command => '/sbin/mkswap /var/swap.1 && /sbin/swapon /var/swap.1',
23
+ unless => '/sbin/swapon -s | grep /var/swap.1',
24
+ }
25
+
26
+ #add swap file entry to fstab
27
+ -> exec {'add swapfile entry to fstab':
28
+ command => '/bin/echo >>/etc/fstab /var/swap.1 swap swap defaults 0 0',
29
+ user => root,
30
+ unless => "/bin/grep '^/var/swap.1' /etc/fstab 2>/dev/null",
31
+ }
32
+ } elsif $::kernel == 'windows' {
33
+ # For performance reasons in VirtualBox
34
+ exec { 'disable windows defender':
35
+ command => 'Set-MpPreference -DisableArchiveScanning $true -DisableRealtimeMonitoring $true',
36
+ provider => 'powershell',
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,8 @@
1
+ # TODO: Docs
2
+ class profile::base()
3
+ {
4
+ contain "profile::base::${::deployment_zone}"
5
+ contain profile::base::config
6
+ contain profile::base::hosts
7
+ contain profile::base::packages
8
+ }
@@ -0,0 +1,20 @@
1
+ class profile::puppetserver()
2
+ {
3
+ package {
4
+ 'puppetserver':
5
+ ensure => 'present';
6
+ }
7
+
8
+ -> service { 'puppetserver':
9
+ ensure => 'running',
10
+ }
11
+
12
+ -> class { 'puppetdb':
13
+ postgresql_ssl_on => false,
14
+ database_host => 'puppetserver.example.com',
15
+ database_listen_address => '0.0.0.0',
16
+ manage_firewall => false,
17
+ }
18
+
19
+ class { 'puppetdb::master::config': }
20
+ }
@@ -0,0 +1 @@
1
+ class role::puppet_enterprise {}
@@ -0,0 +1,7 @@
1
+ class role::puppetserver(){
2
+ contain profile::base
3
+ contain profile::puppetserver
4
+
5
+ Class['profile::base']
6
+ -> Class['profile::puppetserver']
7
+ }
@@ -0,0 +1,42 @@
1
+ require "yaml"
2
+
3
+ module Vagrant
4
+ class Vagrantfile
5
+ def initialize(loader, keys)
6
+ @keys = keys
7
+ @loader = loader
8
+ @config, _ = loader.load(keys)
9
+ @logger = Log4r::Logger.new("vagrant::vagrantfile")
10
+ vagrant_root = Dir.pwd
11
+ @config.ssh.insert_key = false
12
+ config_reader = Vagrant::ConfigReader.new("#{vagrant_root}/#{@config.em.config_file}")
13
+ @models = config_reader.read_configuration
14
+ File.write("#{vagrant_root}/puppet_version", ENV["PUPPET_VERSION"]) if ENV["PUPPET_VERSION"]
15
+ @models.each do |model|
16
+ config.vm.define model.name do |vm|
17
+ raise InvalidType if model.type.empty?
18
+
19
+ @provisioners = []
20
+
21
+ class_name = "Vagrant::EM::#{model.type.split("-").map(&:capitalize).join}"
22
+ if Object.const_defined?(class_name)
23
+ Object.const_get(class_name).setup(config, vm, model, @provisioners, @models)
24
+ else
25
+ raise "#{model.type} is invalid."
26
+ end
27
+ apply_provisioners(config, vm, model)
28
+ end
29
+ end
30
+ end
31
+
32
+ private
33
+
34
+ def apply_provisioners(config, vm, servers)
35
+ @provisioners.each do |provisioner|
36
+ provisioner.each do |type, options|
37
+ vm.vm.provision type, **options
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,44 @@
1
+ module VagrantPlugins
2
+ class AdressManager
3
+ require 'singleton'
4
+
5
+ include Singleton
6
+
7
+ def initialize(base_ip)
8
+ @base_ip = base_ip
9
+ @registered_nodes = {}
10
+ @next_ip_index = 1 # Start from the first available IP after the base
11
+ end
12
+
13
+ def self.instance(base_ip)
14
+ @instance ||= new(base_ip)
15
+ end
16
+
17
+ def register_node(node_name)
18
+ return @registered_nodes[node_name] if @registered_nodes.key?(node_name)
19
+
20
+ # Generate the next IP address
21
+ new_ip = generate_ip(@next_ip_index)
22
+ @registered_nodes[node_name] = new_ip
23
+ @next_ip_index += 1 # Increment for the next node
24
+ new_ip
25
+ end
26
+
27
+ private
28
+
29
+ def generate_ip(index)
30
+ # Assuming the base IP is in the format "192.168.1.1"
31
+ base_parts = @base_ip.split('.').map(&:to_i)
32
+ last_part = base_parts[3] + index
33
+
34
+ if last_part > 250
35
+ base_parts[2] += last_part / 256 # Increment the second to last part
36
+ base_parts[3] = last_part % 256 # Set the last part to the remainder
37
+ else
38
+ base_parts[3] = last_part
39
+ end
40
+
41
+ "#{base_parts[0]}.#{base_parts[1]}.#{base_parts[2]}.#{base_parts[3]}"
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,29 @@
1
+ require "vagrant"
2
+
3
+ module VagrantPlugins
4
+ module Em
5
+ module Demos
6
+ module Command
7
+ class Cleanup < Vagrant.plugin("2", :command)
8
+ def execute
9
+ destination_dir = "./modules/software/files/"
10
+ @env.ui.info("Cleaning up software files...")
11
+ # Get the active machines and their configurations
12
+ with_target_vms(ARGV[1]) do |machine|
13
+ model = machine.env.vagrantfile.instance_variable_get(:@models).find { |m| m.name == machine.name.to_s }
14
+ next if model.nil?
15
+
16
+ model.software_files&.each do |file|
17
+ if File.exist?("#{destination_dir}/#{file}")
18
+ @env.ui.info("Removing File #{file} for #{machine.name}...")
19
+ FileUtils.rm("#{destination_dir}/#{file}")
20
+ end
21
+ end
22
+ end
23
+ 0
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,35 @@
1
+ require "vagrant"
2
+
3
+ module VagrantPlugins
4
+ module Em
5
+ module Demos
6
+ module Command
7
+ class Prepare < Vagrant.plugin("2", :command)
8
+ def execute
9
+ raise "Must specify a VM name" if ARGV[1].nil?
10
+ @env.ui.info("Copying required software files...")
11
+
12
+ # Get the active machines and their configurations
13
+ with_target_vms(ARGV[1]) do |machine|
14
+ source_dir = File.expand_path("~/software")
15
+ destination_dir = "./modules/software/files/"
16
+ FileUtils.mkdir_p(destination_dir)
17
+
18
+ model = machine.env.vagrantfile.instance_variable_get(:@models).find { |m| m.name == ARGV[1] }
19
+ model.software_files.each do |file|
20
+ if File.exist?("#{destination_dir}/#{file}")
21
+ @env.ui.info("Skipping File #{file} as it already exists...")
22
+ else
23
+ # Copy files from source to destination
24
+ @env.ui.info("Fetching File #{file}...")
25
+ FileUtils.cp("#{source_dir}/#{file}", destination_dir)
26
+ end
27
+ end
28
+ end
29
+ 0
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,20 @@
1
+ module VagrantPlugins
2
+ module Em
3
+ module Demos
4
+ class Config < Vagrant.plugin("2", :config)
5
+ attr_accessor :config_file
6
+
7
+ def initialize
8
+ @config_file = UNSET_VALUE
9
+ end
10
+
11
+ def finalize!
12
+ @config_file = "servers.yaml" if @config_file == UNSET_VALUE
13
+ end
14
+
15
+ def validate(machine)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,118 @@
1
+ require "yaml"
2
+
3
+ module Vagrant
4
+ class ConfigReader
5
+ VALID_KEYS = [
6
+ "dhcp_fix",
7
+ "public_ip",
8
+ "private_ip",
9
+ "domain_name",
10
+ "additional_hosts",
11
+ "box",
12
+ "puppet_master",
13
+ "disks",
14
+ "cluster",
15
+ "puppet_installer",
16
+ "required_plugins",
17
+ "software_files",
18
+ "protocol",
19
+ "type",
20
+ "cpucount",
21
+ "ram",
22
+ "virtualboxorafix",
23
+ "needs_storage",
24
+ "custom_facts",
25
+ "mount_uid",
26
+ "mount_gid",
27
+ "run_r10k",
28
+ "ip_start_address",
29
+ "prefix"
30
+ ]
31
+
32
+ def initialize(yaml_path)
33
+ @yaml_path = yaml_path
34
+ end
35
+
36
+ def read_configuration
37
+ content = YAML.load_file(@yaml_path)
38
+ processed_content = process_content(content)
39
+ merged_content = merge_defaults(processed_content)
40
+ validate_definitions!(merged_content)
41
+
42
+ # Convert validated YAML to Server objects
43
+ merged_content.each_with_index.collect { |(name, attributes) , index|
44
+ Models::Server.new(name, attributes, index)
45
+ }
46
+ end
47
+
48
+ private
49
+
50
+ def process_content(content)
51
+ processed_content = {}
52
+ content.each do |key, values|
53
+ if ["ml-", "pe-", "ps-"].include?(key[0, 3]) || key == "defaults"
54
+ processed_content[key] = values
55
+ else
56
+ processed_content["ml-#{key}"] = values
57
+ processed_content["pe-#{key}"] = values
58
+ processed_content["ps-#{key}"] = values
59
+ end
60
+ end
61
+ processed_content
62
+ end
63
+
64
+ def merge_defaults(content)
65
+ defaults_file = File.join(File.dirname(__FILE__), "defaults.yaml")
66
+ gem_defaults = YAML.load_file(defaults_file)
67
+
68
+ defaults = gem_defaults.delete("defaults").merge(content.delete("defaults") || {})
69
+ pe_defaults = gem_defaults.delete("pe-defaults").merge(content.delete("pe-defaults") || {})
70
+ ml_defaults = gem_defaults.delete("ml-defaults").merge(content.delete("ml-defaults") || {})
71
+ ps_defaults = gem_defaults.delete("ps-defaults").merge(content.delete("ps-defaults") || {})
72
+ content.merge!(gem_defaults)
73
+
74
+ content.each do |key, values|
75
+ case key[0, 3]
76
+ when "ml-"
77
+ content[key] = defaults.merge(ml_defaults).merge(values)
78
+ when "pe-"
79
+ content[key] = defaults.merge(pe_defaults).merge(values)
80
+ when "ps-"
81
+ content[key] = defaults.merge(ps_defaults).merge(values)
82
+ end
83
+ end
84
+
85
+ validate_definitions!(content)
86
+ content
87
+ end
88
+
89
+ def validate_definitions!(content)
90
+ errors = []
91
+
92
+ content.each do |key, values|
93
+ # errors << validate_node_prefix(key)
94
+ errors << validate_known_keys(key, values)
95
+ end
96
+
97
+ errors.compact!
98
+ errors.flatten!
99
+
100
+ if errors.any?
101
+ puts "#{@yaml_path} contains following errors:"
102
+ errors.each { |e| puts "- #{e}" }
103
+ raise InvalidDefinition
104
+ end
105
+ end
106
+
107
+ def validate_node_prefix(key)
108
+ return if key[0, 3] == "ml-" || key[0, 3] == "pe-" || key[0, 3] == "ps-"
109
+ "Node #{key} needs an 'ml-' prefix for masterless or a 'pe-' prefix for Puppet agent or a 'ps-' prefix for Puppet Server"
110
+ end
111
+
112
+ def validate_known_keys(key, values)
113
+ unknown_keys = values.keys - VALID_KEYS
114
+ return if unknown_keys.empty?
115
+ "Node #{key} contains unknown entries #{unknown_keys.join(", ")}"
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,54 @@
1
+ ---
2
+ #
3
+ # The default settings for all nodes
4
+ #
5
+ defaults:
6
+ domain_name: example.com
7
+ cpucount: 1
8
+ ram: 4096
9
+ protocol: ssh
10
+ dhcp_fix: false
11
+ needs_storage: false
12
+ additional_hosts: []
13
+ virtualboxorafix: false
14
+ required_plugins: []
15
+ run_r10k: true
16
+ custom_facts:
17
+ deployment_zone: vagrant
18
+ #
19
+ # The default settings for all ML nodes
20
+ #
21
+ ml-defaults:
22
+ type: masterless
23
+ #
24
+ # The default settings for all PE nodes
25
+ #
26
+ pe-defaults:
27
+ mount_uid: 983
28
+ mount_gid: 983
29
+ type: pe-agent
30
+ puppet_master: puppetserver
31
+ #
32
+ # The default settings for all PS nodes
33
+ #
34
+ ps-defaults:
35
+ mount_uid: 52
36
+ mount_gid: 52
37
+ type: agent
38
+ puppet_master: puppetserver
39
+
40
+ ps-puppetserver:
41
+ type: ps-server
42
+ box: generic/rocky9
43
+ cpucount: 2
44
+ ram: 6144
45
+ #
46
+ # The settings for the Puppet Enterprise Server
47
+ #
48
+ pe-puppetserver:
49
+ puppet_master: puppetserver
50
+ type: pe-master
51
+ box: generic/rocky9
52
+ cpucount: 2
53
+ ram: 6144
54
+ puppet_installer: puppet-enterprise-2023.8.1-el-9-x86_64/puppet-enterprise-installer
@@ -0,0 +1,15 @@
1
+ module Vagrant
2
+ module EM
3
+ class FilesNotFoundError < Vagrant::Errors::VagrantError
4
+ def error_message
5
+ "Missing software files"
6
+ end
7
+ end
8
+
9
+ class InvalidDefinition < Vagrant::Errors::VagrantError
10
+ def error_message
11
+ "Invalid definition in server.yaml"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,97 @@
1
+ require "ostruct"
2
+
3
+ module Vagrant
4
+ module Models
5
+ class Disk
6
+ attr_reader :name, :size, :uuid
7
+
8
+ def initialize(name, attributes)
9
+ @name = name
10
+ @size = attributes["size"]
11
+ @uuid = attributes["uuid"]
12
+ end
13
+ end
14
+
15
+ class AdditionalHost
16
+ attr_reader :name, :ip, :domain_name
17
+
18
+ def initialize(name, attributes, domain_name)
19
+ @name = name
20
+ @ip = attributes["ip"]
21
+ @domain_name = domain_name
22
+ end
23
+
24
+ def fqdn
25
+ "#{name}.#{domain_name}"
26
+ end
27
+ end
28
+
29
+ class Server
30
+ ATTRIBUTES = [
31
+ :name, :type, :box, :domain_name, :public_ip, :private_ip,
32
+ :cpucount, :ram, :puppet_master, :puppet_installer,
33
+ :protocol, :disks, :additional_hosts, :custom_facts,
34
+ :required_plugins, :software_files, :needs_storage,
35
+ :virtualboxorafix, :dhcp_fix, :cluster, :run_r10k, :mount_uid,
36
+ :mount_gid, :prefix, :ip_start_address, :ipaddress
37
+ ]
38
+ attr_reader(*ATTRIBUTES)
39
+ attr_accessor :generated_ip, :index, :vmname
40
+
41
+ def initialize(name, attributes, index)
42
+ ATTRIBUTES.each do |attr|
43
+ instance_variable_set(:"@#{attr}", attributes[attr.to_s])
44
+ end
45
+ # Change the name if needed
46
+ parts = name.split("-")
47
+ if @prefix && !parts[1].start_with?(@prefix)
48
+ @vmname = "#{parts[0]}-#{@prefix}#{parts[1]}"
49
+ else
50
+ @vmname = name
51
+ end
52
+ @name = name
53
+ @index = index
54
+ if ip_start_address
55
+ adress_manager = VagrantPlugins::AdressManager.instance(ip_start_address)
56
+ @generated_ip = adress_manager.register_node(fqdn)
57
+ @ipaddress = @generated_ip
58
+ else
59
+ fail "priate_ip or ip_start_address is required"
60
+ @ipaddress = @private_ip
61
+ end
62
+
63
+ initialize_disks(attributes["disks"])
64
+ initialize_additional_hosts(attributes["additional_hosts"])
65
+ end
66
+
67
+
68
+ def hostname
69
+ @name[3..] # Removes 'ml-' or 'pe-' prefix
70
+ end
71
+
72
+ def fqdn
73
+ "#{hostname}.#{domain_name}"
74
+ end
75
+
76
+ private
77
+
78
+ def initialize_disks(disks_hash)
79
+ @disks = if disks_hash
80
+ disks_hash.map { |name, attributes| Disk.new(name, attributes) }
81
+ else
82
+ []
83
+ end
84
+ end
85
+
86
+ def initialize_additional_hosts(hosts_hash)
87
+ @additional_hosts = if hosts_hash
88
+ hosts_hash.map { |name, attributes|
89
+ AdditionalHost.new(name, attributes, domain_name)
90
+ }
91
+ else
92
+ []
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,40 @@
1
+ require "vagrant"
2
+ require_relative "models"
3
+ require_relative "config"
4
+ require_relative "errors"
5
+ require_relative "config_reader"
6
+ require_relative "types/base"
7
+ require_relative "adress_manager"
8
+ # Dynamically require all Ruby files in the 'types' directory
9
+ Dir[File.join(__dir__, "types", "*.rb")].each do |file|
10
+ require_relative file
11
+ end
12
+
13
+ module VagrantPlugins
14
+ module Em
15
+ module Demos
16
+ class Plugin < Vagrant.plugin("2")
17
+ name "EM Demos Provisioner"
18
+ description "Provides custom provisioning for Vagrant environments."
19
+
20
+ require_relative "Vagrantfile"
21
+
22
+ config "em" do
23
+ Config
24
+ end
25
+
26
+ # Copies all software files to modules/software
27
+ command "prepare" do
28
+ require_relative "command/prepare"
29
+ Command::Prepare
30
+ end
31
+
32
+ # Cleans up all software files from modules/software
33
+ command "cleanup" do
34
+ require_relative "command/cleanup"
35
+ Command::Cleanup
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end