15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/danarchy_deploy.rb', line 15
def self.new(deployment, options)
puts "\n" + self.name
puts "Pretend run! Not making any changes." if options[:pretend]
puts 'Begining Deployment:'
printf("%12s %0s\n", 'Hostname:', deployment[:hostname])
printf("%12s %0s\n", 'OS:', deployment[:os])
printf("%12s %0s\n", 'Packages:', deployment[:packages].join(', ')) if deployment[:packages]
deployment = DanarchyDeploy::System.new(deployment, options)
deployment = DanarchyDeploy::Services.new(deployment, options)
deployment = DanarchyDeploy::Groups.new(deployment, options)
deployment = DanarchyDeploy::Users.new(deployment, options)
deployment = DanarchyDeploy::Services::Init.new(deployment, options)
deployment[:last_deploy] = Time.now.strftime("%Y/%m/%d %H:%M:%S")
puts "\nFinished Local Deployment at #{deployment[:last_deploy]}!"
if options[:deploy_file].end_with?('.json')
File.write(options[:deploy_file], JSON.pretty_generate(deployment))
elsif options[:deploy_file].end_with?('.yaml')
File.write(options[:deploy_file], deployment.to_yaml)
end
deployment
end
|