{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEU`}}",
"aws_secret_key": "{{env `AWS_SECRET_KEY`}}",
"atlas_token": "{{env `ATLAS_TOKEN`}}"
},
"provisioners": [
{
"type": "shell",
"execute_command": "echo '{{user `ssh_pass`}}' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"scripts": [
"scripts/base.sh",
"scripts/vagrant.sh",
"scripts/virtualbox.sh"
]
},
{
"type": "file",
"source": "files/perl.conf",
"destination": "/tmp/perl.conf"
},
{
"type": "shell",
"execute_command": "echo '{{user `ssh_pass`}}' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"scripts": [
"scripts/cleanup.sh"
]
}
],
"push": {
"name": "jjn1056/catme",
"token": "{{user `atlas_token`}}"
},
"builders": [
{
"type": "virtualbox-iso",
"boot_command": [
"<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg<enter><wait>"
],
"boot_wait": "10s",
"disk_size": 81920,
"guest_os_type": "RedHat_64",
"headless": false,
"http_directory": "http",
"iso_urls": [
],
"iso_checksum_type": "md5",
"iso_checksum": "9381a24b8bee2fed0c26896141a64b69",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_wait_timeout": "10000s",
"shutdown_command": "echo 'vagrant'|sudo -S /sbin/halt -h -p",
"guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
"virtualbox_version_file": ".vbox_version",
"vm_name": "packer-centos-6.7-x86_64"
}
],
"post-processors": [
[
{
"type": "vagrant",
"keep_input_artifact": false,
"output": "builds/{{.Provider}}-centos67.box",
"vagrantfile_template": "files/Vagrantfile.template",
},
{
"type": "atlas",
"token": "{{user `atlas_token`}}",
"artifact": "jjn1056/catme",
"artifact_type": "vagrant.box",
"metadata": {
"provider": "virtualbox",
"version": "2.0.2",
"created_at": "{{timestamp}}",
"description": "Catme on the desktop"
}
},
{
"type": "atlas",
"token": "{{user `atlas_token`}}",
"artifact": "jjn1056/catme",
"artifact_type": "vagrant.box",
"metadata": {
"provider": "aws",
"version": "2.0.2",
"created_at": "{{timestamp}}",
"description": "Catme on the cloud"
}
}
]
]
}
And the file 'files/Vagrantfile.template'
Vagrant.configure(2) do |config|
config.vm.box = "jjn1056/catme"
config.vm.provider :virtualbox do |override|
override.vm.box = "jjn1056/catme"
override.vm.network "forwarded_port", guest: 80, host: 8080
override.vm.network "forwarded_port", guest: 443, host: 8443
override.vm.network "forwarded_port", guest: 5432, host: 5432
override.vm.network "private_network", ip: "192.168.33.10"
end
config.vm.provider :aws do |aws, override|
override.vm.box = "aws_dummy_box"
override.ssh.username = "ubuntu"
override.ssh.private_key_path = "#{ENV['HOME']}/.ssh/id_rsa"
aws.access_key_id = "#{ENV['AWS_ACCESS_KEY']}"
aws.secret_access_key = "#{ENV['AWS_SECRET_KEY']}"
aws.ami = "ami-524e4726"
aws.region = "eu-west-1"
aws.availability_zone = "eu-west-1c"
aws.instance_type = "m1.small"
aws.security_groups = [ "" ]
aws.keypair_name = "ZZZZZ"
end
config.vm.provision "shell", inline: <<-SHELL
sudo -E su vagrant -c 'GIT_SSH_COMMAND="ssh -v" git clone gitosis@XXXX:catme.git /vagrant/catme-git'
sudo -E ln -s /vagrant/catme-git/catme /var/www/catme
sudo -E ln -s /vagrant/catme-git/catme-lib /var/www/catme-lib
sudo -E /vagrant/catme-git/catme-lib/master-pages/makelinks-soft.sh
mkdir -p /var/www/catme-lib/tmp
chmod 775 /var/www/catme-lib/tmp
sudo perl -p -i -e "s/User apache/User vagrant/" /etc/httpd/conf/httpd.conf
sudo perl -p -i -e "s/Group apache/Group vagrant/" /etc/httpd/conf/httpd.conf
sudo /etc/init.d/httpd start
PGPASSWORD=XXXXXXX psql catme catmerw -f /vagrant/catme-git/catme-lib/config/dbbackups/hals_dump.sql
SHELL
end
Would appreciate any sort of hint. I figure I must have a number of things wrong, but this one is really stopping me. I do 'packer push template.json' it goes out to atlas, builds with no errors , I see a vagrant box is there two both providers but I never get the expected Vagrantfile when I do init. Its really getting me :)