Commit a797a500 authored by Walter Heck's avatar Walter Heck

updated .gitignore so it doesn't ignore the packer module directory in the...

updated .gitignore so it doesn't ignore the packer module directory in the packer path. Also adding all files there that were previously missing.
parent 9ad3c40a
modules
deploy/vagrant-oscar/.pe_build
deploy/vagrant-oscar/.vagrant
vendor/bundle
terraform.tfstate
Gemfile.lock
modules/
!deploy/packer/manifests/modules
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/T0ADg8YIX6C9OvDK8V3O4m2KKTaTcShuAfdhSP8/E6w2SUWwLZVGHM8bD65SnDwXnVo89+La2Yn/7QmJyqZO31LVPh2sMzGFmw57a/s06h2ujkWE3jOL5w9cUBWrrkdP7xbUXFWi6fi+PjSi9/vI1IpBi3X7EmI3mC9ftV9QZbj2wQclhpTNsGaCSJA3ye7G/+7XNWXwaMsPxmTYqD4PBZlbVXQ4dqR3oObkZ8wNWd+qmMvxeSuJ69rSGWTeIqwdGpm2vfcIqn1GM2r+lcCBIB+VXoLDN0zNia2+j5KItVHMyDU+/lQS3oYGdejM2cd6fDBcW1AiSijUbQr0d+fR ci+enterprise@puppetlabs.com
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIrRlZ7kz3U/uOjiXrmJpumRHo8fDWBo+AOCSdqokqNRcALUrpNr6iHRR68Ki1EzPRSvGsdqrh9riStAlJxVroLZt8t2Mt+McydxdvHwJcDSWpZ+UZ1KGXUS1vg4569JZjdi+Gl70WAzJqTxhqIogwcNuZbMMBvJe9oAMCXS1TYMXfPiEcw/hQD/kBNvkSMGTn/siMlNPtaCF+rzlarzUqkEpUnsHmGwqFVHLeVFZ94+2ZD3CzBeJ6m3Ke9IA5ytzOYyPuFP/NVNnEnSrwwe7GSjnxZWT2dzjUrqMgGphWFmeU35oz7r+HxRXsugbMUyN3HEudU268ciYeAvG4xMY3 sqa+ci@puppetlabs.com
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAsMvODgIqL1NoUgP65qmgf0sJjQy78QdA5rH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R5N2ek54XHhReUqm0PiImLFXT sqa+builders@puppetlabs.com
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsFUzpOJRglp/6/nEzkRriTuKfc+OcAyfFhgGx2lR+CR2pzGYus5VrcHalT/lHphbc5NGMXGa6tVYNkMPXNvrThlBwHhh9FFx5/6LRXbq8/LD2tDAW1tyPU04Qk0LNvoq+GSX/QPdumgwThlSEqkdBO0EQIR2CR8XYWIytFcYolPoozrolFoaiDyymZCJE4CaPi3TFTb1DIBm4i0VrHFXvdeAsMAe9J5x4wAd14UjDjghYNN/0GnoYxzDk6JnKX00Hvs3AriPJrW5Y7UBA6eGdISsLZRtOw5NKdiTEGH3VWwupIUc049FFpa83V0ySX0YwqGLhClTjk8ltMulcqF0J sqa+shipper@puppetlabs.com
send host-name = pick-first-value(gethostname(), "ISC-dhclient");
\ No newline at end of file
class packer::networking inherits packer::networking::params {
if ( $udev_rule != undef ) {
file { $udev_rule:
ensure => absent,
}
}
if ( $udev_rule_gen != undef ) {
file { $udev_rule_gen:
ensure => link,
target => '/dev/null',
}
}
if ( $interface_script != undef ) {
file_line { "remove ${interface_script} hwaddr":
path => $interface_script,
line => '#HWADDR withheld',
match => 'HWADDR',
}
}
}
class packer::networking::params {
case $::osfamily {
debian: {
$udev_rule = '/etc/udev/rules.d/70-persistent-net.rules'
$udev_rule_gen = '/lib/udev/rules.d/75-persistent-net-generator.rules'
}
redhat: {
case $::operatingsystemrelease {
'7.0.1406', '7.1.1503', '7.2.1511', '7.2': {
case $::provisioner {
'virtualbox': { $interface_script = '/etc/sysconfig/network-scripts/ifcfg-enp0s3' }
'vmware': { $interface_script = '/etc/sysconfig/network-scripts/ifcfg-ens33' }
}
$udev_rule = '/etc/udev/rules.d/70-persistent-net.rules'
$udev_rule_gen = '/lib/udev/rules.d/75-persistent-net-generator.rules'
}
'5.11': {
$interface_script = '/etc/sysconfig/network-scripts/ifcfg-eth0'
$udev_rule = '/etc/udev/rules.d/70-persistent-net.rules'
}
/2\d/: {
case $::provisioner {
'virtualbox': { $interface_script = '/etc/sysconfig/network-scripts/ifcfg-enp0s3' }
'vmware': { $interface_script = '/etc/sysconfig/network-scripts/ifcfg-ens33' }
}
}
default: {
$interface_script = '/etc/sysconfig/network-scripts/ifcfg-eth0'
$udev_rule = '/etc/udev/rules.d/70-persistent-net.rules'
$udev_rule_gen = '/lib/udev/rules.d/75-persistent-net-generator.rules'
}
}
}
default: {
fail( "Unsupported platform: ${::osfamily}/${::operatingsystem}" )
}
}
}
class packer::puppet {
case $::osfamily {
debian: {
include apt
apt::source { 'puppetlabs-pc1':
location => 'http://apt.puppetlabs.com',
repos => 'PC1',
key => '4BD6EC30',
key_server => 'pgp.mit.edu',
}
package { 'puppet-agent':
ensure => present,
require => Apt::Source[ 'puppetlabs-pc1' ],
}
}
redhat: {
if $operatingsystem == "Fedora" {
$ostype = 'fedora'
$prefix = 'f'
} elsif $osfamily == "RedHat" {
$ostype = 'el'
$prefix = ''
}
else {
err("Unable to determine operating system information to assign yum repo.")
}
yumrepo { 'puppetlabs-pc1':
baseurl => "http://yum.puppetlabs.com/${ostype}/${prefix}\$releasever/PC1/\$basearch",
descr => "Puppet Labs PC1 Repository ${ostype} $releasever - \$basearch",
gpgkey => 'http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs',
enabled => '1',
gpgcheck => '1',
}
package { 'puppet-agent':
ensure => present,
require => Yumrepo[ 'puppetlabs-pc1' ],
}
}
default: {
fail( "Unsupported platform: ${::osfamily}/${::operatingsystem}" )
}
}
file { '/etc/profile.d/append-puppetlabs-path.sh':
mode => '0644',
content => 'PATH=$PATH:/opt/puppetlabs/bin',
}
}
class packer::sshd {
class { 'ssh::server':
storeconfigs_enabled => false,
options => {
'PermitRootLogin' => 'yes',
'UseDNS' => 'no',
'GSSAPIAuthentication' => 'no',
},
}
}
class packer::updates {
$linux_pkgs = [
'bash',
'openssl',
]
$debian_pkgs = [
'libc6',
'openssh-client',
'openssh-server',
]
$redhat_pkgs = [
'glibc',
'openssh',
]
if $::osfamily == 'Debian' {
$pkgs_to_update = $linux_pkgs + $debian_pkgs
} elsif $::osfamily == 'Redhat' {
$pkgs_to_update = $linux_pkgs + $redhat_pkgs
}
package { $pkgs_to_update: ensure => latest; }
}
class packer::vagrant inherits packer::vagrant::params {
group { 'vagrant':
ensure => present,
}
user { 'vagrant':
ensure => present,
home => "${home_base}/vagrant",
managehome => true,
gid => 'vagrant',
groups => [ 'vagrant', ],
shell => '/bin/bash',
require => Group[ 'vagrant' ],
}
file { "${home_base}/vagrant/.ssh":
ensure => directory,
owner => 'vagrant',
group => 'vagrant',
mode => '0600',
require => User[ 'vagrant' ],
}
ssh_authorized_key { 'vagrant':
ensure => present,
user => 'vagrant',
key => 'AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ==',
type => 'ssh-rsa',
}
class { 'sudo': }
sudo::conf { 'vagrant':
content => '%vagrant ALL=(ALL) NOPASSWD: ALL',
}
file_line { "allow ${sudoers_file} notty":
path => $sudoers_file,
line => '#Defaults requiretty',
match => 'Defaults\s+requiretty',
}
}
class packer::vagrant::params {
case $::osfamily {
debian, redhat: {
$home_base = '/home'
$sudoers_file = '/etc/sudoers'
}
default: {
fail( "Unsupported platform: ${::osfamily}/${::operatingsystem}" )
}
}
}
class packer::vmtools inherits packer::vmtools::params {
if ( $required_packages != undef ) {
package { $required_packages:
ensure => installed,
before => File[ '/tmp/vmtools' ],
}
}
file { '/tmp/vmtools':
ensure => directory,
}
mount { '/tmp/vmtools':
ensure => mounted,
device => "${root_home}/${tools_iso}",
fstype => 'iso9660',
options => 'ro,loop',
require => File[ '/tmp/vmtools' ],
}
exec { 'install vmtools':
command => $install_cmd,
path => [ '/bin', '/usr/bin', ],
require => Mount[ '/tmp/vmtools' ],
}
exec { 'remove /tmp/vmtools':
command => 'umount /tmp/vmtools ; rmdir /tmp/vmtools',
path => [ '/bin', '/usr/bin', ],
onlyif => 'test -d /tmp/vmtools',
require => Exec[ 'install vmtools' ],
}
case $::operatingsystemrelease {
default: {
file { "${root_home}/${tools_iso}":
ensure => absent,
require => Exec[ 'remove /tmp/vmtools' ],
}
}
}
file_line { "remove /etc/fstab /tmp/vmtools":
path => '/etc/fstab',
line => '#/tmp/vmtools removed',
match => '/tmp/vmtools',
require => Exec[ 'remove /tmp/vmtools' ],
}
}
class packer::vmtools::params {
case $::osfamily {
'Redhat' : {
$root_home = '/root'
$required_packages = [ 'kernel-devel', 'gcc' ]
}
'Debian' : {
$root_home = '/root'
$required_packages = [ "linux-headers-${::kernelrelease}" ]
}
default : {
fail( "Unsupported platform: ${::osfamily}/${::operatingsystem}" )
}
}
case $::provisioner {
virtualbox: {
$tools_iso = 'VBoxGuestAdditions.iso'
$install_cmd = 'sh /tmp/vmtools/VBoxLinuxAdditions.run --nox11 ; true'
}
vmware: {
$tools_iso = 'linux.iso'
$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'
}
default: {
fail( "Unsupported provisioner: ${::provisioner}" )
}
}
}
class packer::vsphere inherits packer::vsphere::params {
include packer::vsphere::repos
include packer::vsphere::networking
include packer::vsphere::fw
user { root:
ensure => present,
password => "$qa_root_passwd"
}
case $::osfamily {
redhat: {
if $::operatingsystemrelease in ['24', '25'] {
Package {
provider => 'dnf',
}
file { '/etc/dhclient.conf':
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/packer/vsphere/dhclient.conf',
}
}
}
}
package { $ruby_package:
ensure => present,
}
file { $bootstrap_file:
owner => 'root',
group => 'root',
mode => '0755',
content => template("packer/vsphere/${bootstrap_file_source}"),
}
file { $startup_file:
owner => 'root',
group => 'root',
mode => '0755',
content => template("packer/vsphere/${startup_file_source}"),
}
file { '/root/.ssh':
owner => 'root',
group => 'root',
mode => '0755',
ensure => directory,
}
file { '/root/.ssh/authorized_keys':
owner => 'root',
group => 'root',
mode => '0755',
source => 'puppet:///modules/packer/vsphere/authorized_keys',
require => File[ '/root/.ssh' ]
}
}
class packer::vsphere::fw {
if ($::osfamily == 'RedHat')
and ($::operatingsystemmajrelease == '7') {
class { 'firewall':
ensure => stopped,
}
}
}
class packer::vsphere::networking inherits packer::networking::params {
class { 'network':
config_file_notify => '',
}
case $::osfamily {
debian: {
if $::operatingsystemrelease in ['15.10', '16.04'] {
network::interface { 'ens32':
enable_dhcp => true,
}
}
}
redhat: {
if ($::operatingsystemmajrelease == '7') {
if ( $interface_script != undef ) {
file { $interface_script:
ensure => absent,
}
}
network::interface { 'ens32':
enable_dhcp => true,
}
}
if ($::operatingsystem == 'Fedora') {
if ( $interface_script != undef ) {
file { $interface_script:
ensure => absent,
}
}
}
}
}
}
class packer::vsphere::params {
$repo_mirror = 'http://osmirror.delivery.puppetlabs.net'
$loweros = downcase($::operatingsystem)
case $::operatingsystem {
'Ubuntu': {
$startup_file = '/etc/rc.local'
$startup_file_source = 'rc.local'
$bootstrap_file = '/etc/vsphere-bootstrap.rb'
$bootstrap_file_source = 'ubuntu.rb.erb'
if $::operatingsystemrelease in ['10.04', '12.04'] {
$ruby_package = [ 'ruby', 'rubygems' ]
}
else {
$ruby_package = [ 'ruby', 'rubygems-integration' ]
}
$repo_name = 'ubuntu'
$repo_list = 'main restricted universe multiverse'
$security_repo_name = 'ubuntu'
$security_release = "${lsbdistcodename}-security"
$updates_release = "${lsbdistcodename}-updates"
}
'Debian': {
$startup_file = '/etc/rc.local'
$startup_file_source = 'rc.local'
$bootstrap_file = '/etc/vsphere-bootstrap.rb'
$bootstrap_file_source = 'debian.rb.erb'
$ruby_package = [ 'ruby' ]
$repo_name = 'debian'
$repo_list = 'main contrib non-free'
$security_repo_name = 'debian-security'
$security_release = "${lsbdistcodename}/updates"
$updates_release = "${lsbdistcodename}-updates"
}
'CentOS', 'Redhat', 'Scientific': {
$startup_file = '/etc/rc.d/rc.local'
$startup_file_source = 'rc.local'
$bootstrap_file = '/etc/vsphere-bootstrap.rb'
$bootstrap_file_source = 'redhat.rb.erb'
$ruby_package = [ 'ruby' ]
$gpgkey = "RPM-GPG-KEY-${::operatingsystem}-${::operatingsystemmajrelease}"
}
'Fedora': {
$startup_file = '/etc/rc.d/rc.local'
$startup_file_source = 'rc.local'
$bootstrap_file = '/etc/vsphere-bootstrap.rb'
$bootstrap_file_source = 'redhat.rb.erb'
$ruby_package = [ 'ruby', 'rubygems' ]
$gpgkey = "RPM-GPG-KEY-${::operatingsystemmajrelease}-${loweros}"
}
default: {
fail( "Unsupported platform: ${::osfamily}/${::operatingsystem}" )
}
}
}
class packer::vsphere::repos inherits packer::vsphere::params {
case $::osfamily {
debian: {
exec { "apt-update":
command => "/usr/bin/apt-get update"
}
Apt::Key <| |> -> Exec["apt-update"]
Apt::Source <| |> -> Exec["apt-update"]
Exec["apt-update"] -> Package <| |>
class { 'apt':
purge => {
'sources.list' => true,
'sources.list.d' => true,
},
}
apt::source { "$lsbdistcodename":
release => $lsbdistcodename,
location => "$repo_mirror/$repo_name",
repos => "$repo_list",
include => {
'src' => true,
'deb' => true,
},
}
apt::source { "${lsbdistcodename}-updates":
release => "$updates_release",
location => "${repo_mirror}/${repo_name}",
repos => "$repo_list",
include => {
'src' => true,
'deb' => true,
},
}
apt::source { "${lsbdistcodename}-security":
release => "$security_release",
location => "${repo_mirror}/${security_repo_name}",
repos => "$repo_list",
include => {
'src' => true,
'deb' => true,
},
}
}
redhat: {
resources { 'yumrepo':
purge => true,
}
yumrepo { "localmirror-os":
descr => "localmirror-os",
baseurl => "${repo_mirror}/${loweros}-${::operatingsystemmajrelease}-${::architecture}/RPMS.os",
gpgcheck => "1",
gpgkey => "file:///etc/pki/rpm-gpg/${gpgkey}"
}
yumrepo { "localmirror-updates":
descr => "localmirror-updates",
baseurl => "${repo_mirror}/${loweros}-${::operatingsystemmajrelease}-${::architecture}/RPMS.updates",
gpgcheck => "1",
gpgkey => "file:///etc/pki/rpm-gpg/${gpgkey}"
}
if $::operatingsystem == 'Fedora' {
yumrepo { "localmirror-everything":
descr => "localmirror-everything",
baseurl => "${repo_mirror}/${loweros}-${::operatingsystemmajrelease}-${::architecture}/RPMS.everything",
gpgcheck => "1",
gpgkey => "file:///etc/pki/rpm-gpg/${gpgkey}"
}
}
}
default: {
fail( "Unsupported platform: ${::osfamily}/${::operatingsystem}" )
}
}
}
#!/usr/bin/ruby
hostname = `vmtoolsd --cmd "info-get guestinfo.hostname"`
hostname = hostname.chomp
puts "Nice to meet you, my VM name is '#{hostname}'."
puts "\n"
puts '- Setting local hostname...'
File.open('/etc/hostname', 'w') do |f|
f.write(hostname)
end
Kernel.system('hostname -F /etc/hostname')
dhc = File.read('/etc/dhcp/dhclient.conf')
File.open('/etc/dhcp/dhclient.conf', 'w') do |f|
dhc.gsub!(/^(#send host-name.*)/, "send host-name \"#{hostname}\";")
f.write(dhc)
end
puts '- Re-obtaining DHCP lease...'
<% if @operatingsystemmajrelease == '6' -%>
Kernel.system('pkill dhclient')
Kernel.system('dhclient -r')
Kernel.system('rm /var/lib/dhcp/dhclient*')
Kernel.system('dhclient eth0')
<% else -%>
Kernel.system('/etc/init.d/networking restart')
Kernel.system('dhclient eth0')
<% end -%>
puts '- Cleaning up...'
Kernel.system('rm /etc/vsphere-bootstrap.rb')
Kernel.system('echo "exit 0" > /etc/rc.local')
puts "\n"
puts 'Done!'
#!/bin/sh -e
( /etc/vsphere-bootstrap.rb ) 2>&1 | /usr/bin/tee /tmp/vsphere-bootstrap.log
exit 0
#!/usr/bin/ruby
hostname = `vmtoolsd --cmd "info-get guestinfo.hostname"`
hostname = hostname.chomp
puts "Nice to meet you, my VM name is '#{hostname}'."
puts "\n"
puts '- Setting local hostname...'
File.open('/etc/hostname', 'w') do |f|
f.write(hostname)
end
Kernel.system('hostname -F /etc/hostname')
puts '- Re-obtaining DHCP lease...'
<% if (@operatingsystem == 'CentOS') or (@operatingsystem == 'Scientific') -%>
<% if @operatingsystemmajrelease == '7' -%>
File.open('/var/lib/NetworkManager/dhclient-ens32.conf', 'a') do |f|
f << "send host-name #{hostname}"
end
Kernel.system('/sbin/service NetworkManager restart')
Kernel.system('/usr/bin/nmcli con down id ens32')
Kernel.system('/usr/bin/nmcli con up id ens32')
<% end -%>
<% if @operatingsystemmajrelease == '6' -%>
File.open('/etc/dhcp/dhclient-eth0.conf', 'a') do |f|
<% end -%>