bitswarmbox 1.0.0.pre16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +70 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/compiler.xml +22 -0
- data/.idea/composerJson.xml +9 -0
- data/.idea/copyright/profiles_settings.xml +3 -0
- data/.idea/misc.xml +23 -0
- data/.idea/modules.xml +8 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +67 -0
- data/Rakefile +34 -0
- data/Vagrantfile +116 -0
- data/bin/bitswarmbox +6 -0
- data/bitswarmbox.gemspec +48 -0
- data/bitswarmbox.iml +51 -0
- data/builders/aws/build-all.sh +17 -0
- data/builders/aws/debian/build-base-jessie64.sh +11 -0
- data/builders/aws/debian/build-base-wheezy64.sh +11 -0
- data/builders/aws/debian/build-puppetmaster-jessie64.sh +11 -0
- data/builders/aws/ubuntu/build-base-precise64.sh +11 -0
- data/builders/aws/ubuntu/build-base-trusty64.sh +11 -0
- data/builders/aws/ubuntu/build-base-wily64.sh +11 -0
- data/builders/aws/ubuntu/build-base-xenial64.sh +11 -0
- data/builders/aws/ubuntu/build-puppetmaster-trusty64.sh +11 -0
- data/builders/aws/ubuntu/build-puppetmaster-xenial64.sh +11 -0
- data/builders/vagrant/build-all.sh +18 -0
- data/builders/vagrant/debian/build-base-jessie64.sh +9 -0
- data/builders/vagrant/debian/build-base-wheezy64.sh +9 -0
- data/builders/vagrant/debian/build-puppetmaster-jessie64.sh +9 -0
- data/builders/vagrant/ubuntu/build-base-precise64.sh +9 -0
- data/builders/vagrant/ubuntu/build-base-trusty64.sh +9 -0
- data/builders/vagrant/ubuntu/build-base-wily64.sh +9 -0
- data/builders/vagrant/ubuntu/build-base-xenial64.sh +9 -0
- data/builders/vagrant/ubuntu/build-puppetmaster-trusty64.sh +17 -0
- data/builders/vagrant/ubuntu/build-puppetmaster-xenial64.sh +17 -0
- data/features/boxes.feature +8 -0
- data/features/build.feature +16 -0
- data/features/env.feature +18 -0
- data/features/support/env.rb +1 -0
- data/lib/bitswarmbox/builder.rb +181 -0
- data/lib/bitswarmbox/command/build/aws.rb +90 -0
- data/lib/bitswarmbox/command/build/vagrant.rb +78 -0
- data/lib/bitswarmbox/command/build.rb +42 -0
- data/lib/bitswarmbox/command/env.rb +50 -0
- data/lib/bitswarmbox/command.rb +15 -0
- data/lib/bitswarmbox/config.rb +87 -0
- data/lib/bitswarmbox/environment.rb +128 -0
- data/lib/bitswarmbox/errors.rb +19 -0
- data/lib/bitswarmbox/subprocess.rb +39 -0
- data/lib/bitswarmbox/template.rb +50 -0
- data/lib/bitswarmbox/version.rb +4 -0
- data/lib/bitswarmbox.rb +29 -0
- data/lib/boxes.rb +29 -0
- data/puppet/Puppetfile +58 -0
- data/puppet/environments/aws/manifests/base.pp +3 -0
- data/puppet/environments/vagrant/environment.conf +1 -0
- data/puppet/environments/vagrant/manifests/base.pp +3 -0
- data/puppet/hiera.yaml +15 -0
- data/puppet/hieradata/aws.yaml +11 -0
- data/puppet/hieradata/common.yaml +9 -0
- data/puppet/hieradata/debian.yaml +6 -0
- data/puppet/hieradata/puppetmaster.yaml +7 -0
- data/puppet/hieradata/ubuntu.yaml +3 -0
- data/puppet/hieradata/vagrant.yaml +3 -0
- data/puppet/hieradata/vsphere.yaml +3 -0
- data/puppet/manifests/r10k_bootstrap.pp +37 -0
- data/puppet/modules/packer/manifests/aws/cloudinit.pp +20 -0
- data/puppet/modules/packer/manifests/aws/networking/params.pp +46 -0
- data/puppet/modules/packer/manifests/aws/networking.pp +23 -0
- data/puppet/modules/packer/manifests/aws/sshd.pp +10 -0
- data/puppet/modules/packer/manifests/aws/users.pp +26 -0
- data/puppet/modules/packer/manifests/aws.pp +7 -0
- data/puppet/modules/packer/manifests/clock.pp +10 -0
- data/puppet/modules/packer/manifests/updates.pp +27 -0
- data/puppet/modules/packer/manifests/vagrant/params.pp +14 -0
- data/puppet/modules/packer/manifests/vagrant.pp +63 -0
- data/puppet/modules/packer/manifests/vmtools/params.pp +35 -0
- data/puppet/modules/packer/manifests/vmtools.pp +52 -0
- data/puppet/modules/packer/manifests/vsphere/fw.pp +9 -0
- data/puppet/modules/packer/manifests/vsphere/networking.pp +29 -0
- data/puppet/modules/packer/manifests/vsphere/params.pp +56 -0
- data/puppet/modules/packer/manifests/vsphere/repos.pp +87 -0
- data/puppet/modules/packer/manifests/vsphere.pp +45 -0
- data/puppet/modules/packer/templates/ec2/ubuntu-cloud-cfg.erb +111 -0
- data/puppet/modules/packer/templates/vsphere/debian.rb.erb +45 -0
- data/puppet/modules/packer/templates/vsphere/rc.local +5 -0
- data/puppet/modules/packer/templates/vsphere/redhat.rb.erb +66 -0
- data/puppet/modules/packer/templates/vsphere/ubuntu.rb.erb +50 -0
- data/scripts/ansible.sh +17 -0
- data/scripts/chef.sh +30 -0
- data/scripts/cleanup-aws.sh +6 -0
- data/scripts/cleanup-vagrant.sh +26 -0
- data/scripts/cleanup.sh +48 -0
- data/scripts/docker.sh +23 -0
- data/scripts/local-ssh-keygen.sh +16 -0
- data/scripts/prepare-done.sh +3 -0
- data/scripts/prepare.sh +32 -0
- data/scripts/puppet.sh +31 -0
- data/scripts/puppetserver-post.sh +8 -0
- data/scripts/puppetserver.sh +44 -0
- data/scripts/ruby.sh +42 -0
- data/scripts/vagrant.sh +42 -0
- data/scripts/vmtools.sh +37 -0
- data/spec/boxes/builder_spec.rb +52 -0
- data/spec/boxes/config_spec.rb +142 -0
- data/spec/boxes/environment_spec.rb +73 -0
- data/spec/boxes/subprocess_spec.rb +35 -0
- data/spec/boxes/template_spec.rb +53 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/support/subprocess_command.rb +7 -0
- data/templates/debian/jessie64.erb +206 -0
- data/templates/debian/preseed.cfg +70 -0
- data/templates/debian/wheezy64.erb +206 -0
- data/templates/ubuntu/precise64.erb +205 -0
- data/templates/ubuntu/preseed.cfg +61 -0
- data/templates/ubuntu/trusty64.erb +205 -0
- data/templates/ubuntu/wily64.erb +209 -0
- data/templates/ubuntu/xenial64.erb +209 -0
- metadata +349 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
class packer::aws::users {
|
2
|
+
include '::packer::aws'
|
3
|
+
$service_acct = $::packer::aws::local_service_acct_user
|
4
|
+
|
5
|
+
if $service_acct != 'ubuntu' {
|
6
|
+
user { $service_acct:
|
7
|
+
ensure => present,
|
8
|
+
home => "/home/${service_acct}",
|
9
|
+
managehome => true,
|
10
|
+
}
|
11
|
+
# ->
|
12
|
+
# sudo::sudoers { $service_acct:
|
13
|
+
# ensure => 'present',
|
14
|
+
# users => [$service_acct],
|
15
|
+
# tags => ['NOPASSWD'],
|
16
|
+
# }
|
17
|
+
}
|
18
|
+
|
19
|
+
class { 'ohmyzsh::config': theme_hostname_slug => '%M' }
|
20
|
+
|
21
|
+
# for multiple users in one shot and set their shell to zsh
|
22
|
+
ohmyzsh::install { 'root': set_sh => true, disable_auto_update => true }
|
23
|
+
ohmyzsh::install { $service_acct: set_sh => true, disable_update_prompt => true }
|
24
|
+
ohmyzsh::plugins { ['root', $service_acct]: }
|
25
|
+
ohmyzsh::theme { ['root', $service_acct]: }
|
26
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class packer::updates {
|
2
|
+
|
3
|
+
$linux_pkgs = [
|
4
|
+
'bash',
|
5
|
+
'openssl',
|
6
|
+
]
|
7
|
+
|
8
|
+
$debian_pkgs = [
|
9
|
+
'libc6',
|
10
|
+
'openssh-client',
|
11
|
+
'openssh-server',
|
12
|
+
]
|
13
|
+
|
14
|
+
$redhat_pkgs = [
|
15
|
+
'glibc',
|
16
|
+
'openssh',
|
17
|
+
]
|
18
|
+
|
19
|
+
if $::osfamily == 'Debian' {
|
20
|
+
$pkgs_to_update = $linux_pkgs + $debian_pkgs
|
21
|
+
} elsif $::osfamily == 'Redhat' {
|
22
|
+
$pkgs_to_update = $linux_pkgs + $redhat_pkgs
|
23
|
+
}
|
24
|
+
|
25
|
+
package { $pkgs_to_update: ensure => latest; }
|
26
|
+
|
27
|
+
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
class packer::vagrant(
|
2
|
+
$manage_user = 'true',
|
3
|
+
$ohymzsh = 'true',
|
4
|
+
$manage_ssh = 'false',
|
5
|
+
$public_rsa_key = 'AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ==',
|
6
|
+
$manage_sudo = 'false',
|
7
|
+
) inherits packer::vagrant::params {
|
8
|
+
|
9
|
+
if str2bool($manage_user) {
|
10
|
+
group { 'vagrant':
|
11
|
+
ensure => present,
|
12
|
+
}
|
13
|
+
|
14
|
+
user { 'vagrant':
|
15
|
+
ensure => present,
|
16
|
+
home => "${home_base}/vagrant",
|
17
|
+
managehome => true,
|
18
|
+
gid => 'vagrant',
|
19
|
+
groups => [ 'vagrant', ],
|
20
|
+
shell => '/bin/bash',
|
21
|
+
require => Group[ 'vagrant' ],
|
22
|
+
}
|
23
|
+
|
24
|
+
if str2bool($ohymzsh) {
|
25
|
+
# for multiple users in one shot and set their shell to zsh
|
26
|
+
ohmyzsh::install { 'root': set_sh => true, disable_auto_update => true }
|
27
|
+
ohmyzsh::install { 'vagrant': set_sh => true, disable_update_prompt => true }
|
28
|
+
ohmyzsh::plugins { ['root', 'vagrant']: }
|
29
|
+
ohmyzsh::theme { ['root', 'vagrant']: }
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
if str2bool($manage_ssh) {
|
34
|
+
file { "${home_base}/vagrant/.ssh":
|
35
|
+
ensure => directory,
|
36
|
+
owner => 'vagrant',
|
37
|
+
group => 'vagrant',
|
38
|
+
mode => '0600',
|
39
|
+
require => User[ 'vagrant' ],
|
40
|
+
}
|
41
|
+
|
42
|
+
ssh_authorized_key { 'vagrant':
|
43
|
+
ensure => present,
|
44
|
+
user => 'vagrant',
|
45
|
+
key => $public_rsa_key,
|
46
|
+
type => 'ssh-rsa',
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
if str2bool($manage_sudo) {
|
51
|
+
sudo::sudoers { 'vagrant':
|
52
|
+
ensure => 'present',
|
53
|
+
users => ['vagrant'],
|
54
|
+
tags => ['NOPASSWD'],
|
55
|
+
}
|
56
|
+
|
57
|
+
file_line { "allow ${sudoers_file} notty":
|
58
|
+
path => $sudoers_file,
|
59
|
+
line => '#Defaults requiretty',
|
60
|
+
match => 'Defaults\s+requiretty',
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class packer::vmtools::params {
|
2
|
+
|
3
|
+
case $::osfamily {
|
4
|
+
'Redhat' : {
|
5
|
+
$root_home = '/root'
|
6
|
+
$required_packages = [ 'kernel-devel', 'gcc' ]
|
7
|
+
}
|
8
|
+
|
9
|
+
'Debian' : {
|
10
|
+
$root_home = '/root'
|
11
|
+
$required_packages = [ "linux-headers-${::kernelrelease}" ]
|
12
|
+
}
|
13
|
+
|
14
|
+
default : {
|
15
|
+
fail( "Unsupported platform: ${::osfamily}/${::operatingsystem}" )
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
case $::provisioner {
|
20
|
+
virtualbox: {
|
21
|
+
$tools_iso = 'VBoxGuestAdditions.iso'
|
22
|
+
$install_cmd = 'sh /tmp/vmtools/VBoxLinuxAdditions.run --nox11 ; true'
|
23
|
+
}
|
24
|
+
|
25
|
+
vmware: {
|
26
|
+
$tools_iso = 'linux.iso'
|
27
|
+
$install_cmd = 'tar zxf /tmp/vmtools/VMwareTools-*.tar.gz -C /tmp/ ; /tmp/vmware-tools-distrib/vmware-install.pl --force-install ; rm -rf /tmp/vmware-tools-distrib'
|
28
|
+
}
|
29
|
+
|
30
|
+
default: {
|
31
|
+
fail( "Unsupported provisioner: ${::provisioner}" )
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
class packer::vmtools inherits packer::vmtools::params {
|
2
|
+
|
3
|
+
if ( $required_packages != undef ) {
|
4
|
+
package { $required_packages:
|
5
|
+
ensure => installed,
|
6
|
+
before => File[ '/tmp/vmtools' ],
|
7
|
+
}
|
8
|
+
}
|
9
|
+
|
10
|
+
file { '/tmp/vmtools':
|
11
|
+
ensure => directory,
|
12
|
+
}
|
13
|
+
|
14
|
+
mount { '/tmp/vmtools':
|
15
|
+
ensure => mounted,
|
16
|
+
device => "${root_home}/${tools_iso}",
|
17
|
+
fstype => 'iso9660',
|
18
|
+
options => 'ro,loop',
|
19
|
+
require => File[ '/tmp/vmtools' ],
|
20
|
+
}
|
21
|
+
|
22
|
+
exec { 'install vmtools':
|
23
|
+
command => $install_cmd,
|
24
|
+
path => [ '/bin', '/usr/bin', ],
|
25
|
+
require => Mount[ '/tmp/vmtools' ],
|
26
|
+
}
|
27
|
+
|
28
|
+
exec { 'remove /tmp/vmtools':
|
29
|
+
command => 'umount /tmp/vmtools ; rmdir /tmp/vmtools',
|
30
|
+
path => [ '/bin', '/usr/bin', ],
|
31
|
+
onlyif => 'test -d /tmp/vmtools',
|
32
|
+
require => Exec[ 'install vmtools' ],
|
33
|
+
}
|
34
|
+
|
35
|
+
case $::operatingsystemrelease {
|
36
|
+
|
37
|
+
default: {
|
38
|
+
file { "${root_home}/${tools_iso}":
|
39
|
+
ensure => absent,
|
40
|
+
require => Exec[ 'remove /tmp/vmtools' ],
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
file_line { "remove /etc/fstab /tmp/vmtools":
|
46
|
+
path => '/etc/fstab',
|
47
|
+
line => '#/tmp/vmtools removed',
|
48
|
+
match => '/tmp/vmtools',
|
49
|
+
require => Exec[ 'remove /tmp/vmtools' ],
|
50
|
+
}
|
51
|
+
|
52
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class packer::vsphere::networking inherits packer::networking::params {
|
2
|
+
|
3
|
+
class { 'network':
|
4
|
+
config_file_notify => '',
|
5
|
+
}
|
6
|
+
|
7
|
+
case $::osfamily {
|
8
|
+
debian: {
|
9
|
+
if $::operatingsystemrelease in ['15.10', '16.04'] {
|
10
|
+
network::interface { 'ens32':
|
11
|
+
enable_dhcp => true,
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
redhat: {
|
17
|
+
if ($::operatingsystemmajrelease == '7') {
|
18
|
+
if ( $interface_script != undef ) {
|
19
|
+
file { $interface_script:
|
20
|
+
ensure => absent,
|
21
|
+
}
|
22
|
+
}
|
23
|
+
network::interface { 'ens32':
|
24
|
+
enable_dhcp => true,
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class packer::vsphere::params {
|
2
|
+
|
3
|
+
$repo_mirror = 'http://osmirror.delivery.puppetlabs.net'
|
4
|
+
$loweros = downcase($::operatingsystem)
|
5
|
+
|
6
|
+
case $::operatingsystem {
|
7
|
+
'Ubuntu': {
|
8
|
+
$startup_file = '/etc/rc.local'
|
9
|
+
$startup_file_source = 'rc.local'
|
10
|
+
$bootstrap_file = '/etc/vsphere-bootstrap.rb'
|
11
|
+
$bootstrap_file_source = 'ubuntu.rb.erb'
|
12
|
+
$ruby_package = [ 'ruby' ]
|
13
|
+
$repo_name = 'ubuntu'
|
14
|
+
$repo_list = 'main restricted universe multiverse'
|
15
|
+
$security_repo_name = 'ubuntu'
|
16
|
+
$security_release = "${lsbdistcodename}-security"
|
17
|
+
$updates_release = "${lsbdistcodename}-updates"
|
18
|
+
}
|
19
|
+
|
20
|
+
'Debian': {
|
21
|
+
$startup_file = '/etc/rc.local'
|
22
|
+
$startup_file_source = 'rc.local'
|
23
|
+
$bootstrap_file = '/etc/vsphere-bootstrap.rb'
|
24
|
+
$bootstrap_file_source = 'debian.rb.erb'
|
25
|
+
$ruby_package = [ 'ruby' ]
|
26
|
+
$repo_name = 'debian'
|
27
|
+
$repo_list = 'main contrib non-free'
|
28
|
+
$security_repo_name = 'debian-security'
|
29
|
+
$security_release = "${lsbdistcodename}/updates"
|
30
|
+
$updates_release = "${lsbdistcodename}-updates"
|
31
|
+
}
|
32
|
+
|
33
|
+
'CentOS', 'Redhat', 'Scientific': {
|
34
|
+
$startup_file = '/etc/rc.d/rc.local'
|
35
|
+
$startup_file_source = 'rc.local'
|
36
|
+
$bootstrap_file = '/etc/vsphere-bootstrap.rb'
|
37
|
+
$bootstrap_file_source = 'redhat.rb.erb'
|
38
|
+
$ruby_package = [ 'ruby' ]
|
39
|
+
$gpgkey = "RPM-GPG-KEY-${::operatingsystem}-${::operatingsystemmajrelease}"
|
40
|
+
}
|
41
|
+
|
42
|
+
'Fedora': {
|
43
|
+
$startup_file = '/etc/rc.d/rc.local'
|
44
|
+
$startup_file_source = 'rc.local'
|
45
|
+
$bootstrap_file = '/etc/vsphere-bootstrap.rb'
|
46
|
+
$bootstrap_file_source = 'redhat.rb.erb'
|
47
|
+
$ruby_package = [ 'ruby' ]
|
48
|
+
$gpgkey = "RPM-GPG-KEY-${::operatingsystemmajrelease}-${loweros}"
|
49
|
+
}
|
50
|
+
|
51
|
+
default: {
|
52
|
+
fail( "Unsupported platform: ${::osfamily}/${::operatingsystem}" )
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
class packer::vsphere::repos inherits packer::vsphere::params {
|
2
|
+
|
3
|
+
case $::osfamily {
|
4
|
+
|
5
|
+
debian: {
|
6
|
+
|
7
|
+
exec { "apt-update":
|
8
|
+
command => "/usr/bin/apt-get update"
|
9
|
+
}
|
10
|
+
|
11
|
+
Apt::Key <| |> -> Exec["apt-update"]
|
12
|
+
Apt::Source <| |> -> Exec["apt-update"]
|
13
|
+
|
14
|
+
Exec["apt-update"] -> Package <| |>
|
15
|
+
|
16
|
+
class { 'apt':
|
17
|
+
purge => {
|
18
|
+
'sources.list' => true,
|
19
|
+
'sources.list.d' => true,
|
20
|
+
},
|
21
|
+
}
|
22
|
+
|
23
|
+
apt::source { "$lsbdistcodename":
|
24
|
+
release => $lsbdistcodename,
|
25
|
+
location => "$repo_mirror/$repo_name",
|
26
|
+
repos => "$repo_list",
|
27
|
+
include => {
|
28
|
+
'src' => true,
|
29
|
+
'deb' => true,
|
30
|
+
},
|
31
|
+
}
|
32
|
+
|
33
|
+
apt::source { "${lsbdistcodename}-updates":
|
34
|
+
release => "$updates_release",
|
35
|
+
location => "${repo_mirror}/${repo_name}",
|
36
|
+
repos => "$repo_list",
|
37
|
+
include => {
|
38
|
+
'src' => true,
|
39
|
+
'deb' => true,
|
40
|
+
},
|
41
|
+
}
|
42
|
+
|
43
|
+
apt::source { "${lsbdistcodename}-security":
|
44
|
+
release => "$security_release",
|
45
|
+
location => "${repo_mirror}/${security_repo_name}",
|
46
|
+
repos => "$repo_list",
|
47
|
+
include => {
|
48
|
+
'src' => true,
|
49
|
+
'deb' => true,
|
50
|
+
},
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
redhat: {
|
55
|
+
|
56
|
+
resources { 'yumrepo':
|
57
|
+
purge => true,
|
58
|
+
}
|
59
|
+
|
60
|
+
yumrepo { "localmirror-os":
|
61
|
+
descr => "localmirror-os",
|
62
|
+
baseurl => "${repo_mirror}/${loweros}-${::operatingsystemmajrelease}-${::architecture}/RPMS.os",
|
63
|
+
gpgcheck => "1",
|
64
|
+
gpgkey => "file:///etc/pki/rpm-gpg/${gpgkey}"
|
65
|
+
}
|
66
|
+
yumrepo { "localmirror-updates":
|
67
|
+
descr => "localmirror-updates",
|
68
|
+
baseurl => "${repo_mirror}/${loweros}-${::operatingsystemmajrelease}-${::architecture}/RPMS.updates",
|
69
|
+
gpgcheck => "1",
|
70
|
+
gpgkey => "file:///etc/pki/rpm-gpg/${gpgkey}"
|
71
|
+
}
|
72
|
+
|
73
|
+
if $::operatingsystem == 'Fedora' {
|
74
|
+
yumrepo { "localmirror-everything":
|
75
|
+
descr => "localmirror-everything",
|
76
|
+
baseurl => "${repo_mirror}/${loweros}-${::operatingsystemmajrelease}-${::architecture}/RPMS.everything",
|
77
|
+
gpgcheck => "1",
|
78
|
+
gpgkey => "file:///etc/pki/rpm-gpg/${gpgkey}"
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
default: {
|
84
|
+
fail( "Unsupported platform: ${::osfamily}/${::operatingsystem}" )
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
class packer::vsphere inherits packer::vsphere::params {
|
2
|
+
|
3
|
+
include packer::vsphere::repos
|
4
|
+
include packer::vsphere::networking
|
5
|
+
include packer::vsphere::fw
|
6
|
+
|
7
|
+
user { root:
|
8
|
+
ensure => present,
|
9
|
+
password => "$qa_root_passwd"
|
10
|
+
}
|
11
|
+
|
12
|
+
package { $ruby_package:
|
13
|
+
ensure => present,
|
14
|
+
}
|
15
|
+
|
16
|
+
file { $bootstrap_file:
|
17
|
+
owner => 'root',
|
18
|
+
group => 'root',
|
19
|
+
mode => '0755',
|
20
|
+
content => template("packer/vsphere/${bootstrap_file_source}"),
|
21
|
+
}
|
22
|
+
|
23
|
+
file { $startup_file:
|
24
|
+
owner => 'root',
|
25
|
+
group => 'root',
|
26
|
+
mode => '0755',
|
27
|
+
content => template("packer/vsphere/${startup_file_source}"),
|
28
|
+
}
|
29
|
+
|
30
|
+
file { '/root/.ssh':
|
31
|
+
owner => 'root',
|
32
|
+
group => 'root',
|
33
|
+
mode => '0755',
|
34
|
+
ensure => directory,
|
35
|
+
}
|
36
|
+
|
37
|
+
file { '/root/.ssh/authorized_keys':
|
38
|
+
owner => 'root',
|
39
|
+
group => 'root',
|
40
|
+
mode => '0755',
|
41
|
+
source => 'puppet:///modules/packer/vsphere/authorized_keys',
|
42
|
+
require => File[ '/root/.ssh' ]
|
43
|
+
}
|
44
|
+
|
45
|
+
}
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# The top level settings are used as module
|
2
|
+
# and system configuration.
|
3
|
+
|
4
|
+
# A set of users which may be applied and/or used by various modules
|
5
|
+
# when a 'default' entry is found it will reference the 'default_user'
|
6
|
+
# from the distro configuration specified below
|
7
|
+
users:
|
8
|
+
- default
|
9
|
+
|
10
|
+
# If this is set, 'root' will not be able to ssh in and they
|
11
|
+
# will get a message to login instead as the above $user (ubuntu)
|
12
|
+
disable_root: true
|
13
|
+
|
14
|
+
# This will cause the set+update hostname module to not operate (if true)
|
15
|
+
preserve_hostname: false
|
16
|
+
|
17
|
+
# Example datasource config
|
18
|
+
# datasource:
|
19
|
+
# Ec2:
|
20
|
+
# metadata_urls: [ 'blah.com' ]
|
21
|
+
# timeout: 5 # (defaults to 50 seconds)
|
22
|
+
# max_wait: 10 # (defaults to 120 seconds)
|
23
|
+
|
24
|
+
# The modules that run in the 'init' stage
|
25
|
+
cloud_init_modules:
|
26
|
+
- migrator
|
27
|
+
- seed_random
|
28
|
+
- bootcmd
|
29
|
+
- write-files
|
30
|
+
- growpart
|
31
|
+
- resizefs
|
32
|
+
- set_hostname
|
33
|
+
- update_hostname
|
34
|
+
- update_etc_hosts
|
35
|
+
- ca-certs
|
36
|
+
- rsyslog
|
37
|
+
- users-groups
|
38
|
+
- ssh
|
39
|
+
|
40
|
+
# The modules that run in the 'config' stage
|
41
|
+
cloud_config_modules:
|
42
|
+
# Emit the cloud config ready event
|
43
|
+
# this can be used by upstart jobs for 'start on cloud-config'.
|
44
|
+
- emit_upstart
|
45
|
+
- disk_setup
|
46
|
+
- mounts
|
47
|
+
- ssh-import-id
|
48
|
+
- locale
|
49
|
+
- set-passwords
|
50
|
+
- grub-dpkg
|
51
|
+
- apt-pipelining
|
52
|
+
- apt-configure
|
53
|
+
- package-update-upgrade-install
|
54
|
+
- landscape
|
55
|
+
- timezone
|
56
|
+
- puppet
|
57
|
+
- chef
|
58
|
+
- salt-minion
|
59
|
+
- mcollective
|
60
|
+
- disable-ec2-metadata
|
61
|
+
- runcmd
|
62
|
+
- byobu
|
63
|
+
|
64
|
+
# The modules that run in the 'final' stage
|
65
|
+
cloud_final_modules:
|
66
|
+
- rightscale_userdata
|
67
|
+
- scripts-vendor
|
68
|
+
- scripts-per-once
|
69
|
+
- scripts-per-boot
|
70
|
+
- scripts-per-instance
|
71
|
+
- scripts-user
|
72
|
+
- ssh-authkey-fingerprints
|
73
|
+
- keys-to-console
|
74
|
+
- phone-home
|
75
|
+
- final-message
|
76
|
+
- power-state-change
|
77
|
+
|
78
|
+
# System and/or distro specific settings
|
79
|
+
# (not accessible to handlers/transforms)
|
80
|
+
system_info:
|
81
|
+
# This will affect which distro class gets used
|
82
|
+
distro: ubuntu
|
83
|
+
# Default user name + that default users groups (if added/used)
|
84
|
+
default_user:
|
85
|
+
name: <%= scope.lookupvar('::packer::ec2::local_service_acct_user') %>
|
86
|
+
lock_passwd: True
|
87
|
+
gecos: <%= scope.lookupvar('::packer::ec2::local_service_acct_gecos') %>
|
88
|
+
groups: [adm, audio, cdrom, dialout, dip, floppy, netdev, plugdev, sudo, video]
|
89
|
+
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
|
90
|
+
shell: /bin/bash
|
91
|
+
# Other config here will be given to the distro class and/or path classes
|
92
|
+
paths:
|
93
|
+
cloud_dir: /var/lib/cloud/
|
94
|
+
templates_dir: /etc/cloud/templates/
|
95
|
+
upstart_dir: /etc/init/
|
96
|
+
package_mirrors:
|
97
|
+
- arches: [i386, amd64]
|
98
|
+
failsafe:
|
99
|
+
primary: http://archive.ubuntu.com/ubuntu
|
100
|
+
security: http://security.ubuntu.com/ubuntu
|
101
|
+
search:
|
102
|
+
primary:
|
103
|
+
- http://%(ec2_region)s.ec2.archive.ubuntu.com/ubuntu/
|
104
|
+
- http://%(availability_zone)s.clouds.archive.ubuntu.com/ubuntu/
|
105
|
+
- http://%(region)s.clouds.archive.ubuntu.com/ubuntu/
|
106
|
+
security: []
|
107
|
+
- arches: [armhf, armel, default]
|
108
|
+
failsafe:
|
109
|
+
primary: http://ports.ubuntu.com/ubuntu-ports
|
110
|
+
security: http://ports.ubuntu.com/ubuntu-ports
|
111
|
+
ssh_svcname: ssh
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
hostname = `vmtoolsd --cmd "info-get guestinfo.hostname"`
|
4
|
+
|
5
|
+
hostname = hostname.chomp
|
6
|
+
|
7
|
+
puts "Nice to meet you, my VM name is '#{hostname}'."
|
8
|
+
|
9
|
+
puts "\n"
|
10
|
+
|
11
|
+
puts '- Setting local hostname...'
|
12
|
+
|
13
|
+
File.open('/etc/hostname', 'w') do |f|
|
14
|
+
f.write(hostname)
|
15
|
+
end
|
16
|
+
|
17
|
+
Kernel.system('hostname -F /etc/hostname')
|
18
|
+
|
19
|
+
dhc = File.read('/etc/dhcp/dhclient.conf')
|
20
|
+
|
21
|
+
File.open('/etc/dhcp/dhclient.conf', 'w') do |f|
|
22
|
+
dhc.gsub!(/^(#send host-name.*)/, "send host-name \"#{hostname}\";")
|
23
|
+
f.write(dhc)
|
24
|
+
end
|
25
|
+
|
26
|
+
puts '- Re-obtaining DHCP lease...'
|
27
|
+
|
28
|
+
<% if @operatingsystemmajrelease == '6' -%>
|
29
|
+
Kernel.system('pkill dhclient')
|
30
|
+
Kernel.system('dhclient -r')
|
31
|
+
Kernel.system('rm /var/lib/dhcp/dhclient*')
|
32
|
+
Kernel.system('dhclient eth0')
|
33
|
+
<% else -%>
|
34
|
+
Kernel.system('/etc/init.d/networking restart')
|
35
|
+
Kernel.system('dhclient eth0')
|
36
|
+
<% end -%>
|
37
|
+
|
38
|
+
puts '- Cleaning up...'
|
39
|
+
|
40
|
+
Kernel.system('rm /etc/vsphere-bootstrap.rb')
|
41
|
+
Kernel.system('echo "exit 0" > /etc/rc.local')
|
42
|
+
|
43
|
+
puts "\n"
|
44
|
+
|
45
|
+
puts 'Done!'
|