Last active
September 26, 2018 10:52
-
-
Save kgorskowski/1ba4bb4e397236e4841c340cc9fb2128 to your computer and use it in GitHub Desktop.
template for my default packer/chef-solo workflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"builders": [{ | |
"ami_block_device_mappings": [{ | |
"device_name": "/dev/sdb", | |
"no_device": "true" | |
}, | |
{ | |
"device_name": "/dev/sdc", | |
"no_device": "true" | |
} | |
], | |
"ami_name": "*ami-name*{{isotime \"2006-01-02-03-04\"}}", | |
"associate_public_ip_address": true, | |
"instance_type": "t2.micro", | |
"region": "*region*", | |
"security_group_id": "*security-group*", | |
"source_ami_filter": { | |
"filters": { | |
"name": "*ubuntu-xenial-16.04-amd64-server-*", | |
"root-device-type": "ebs", | |
"virtualization-type": "hvm" | |
}, | |
"most_recent": true, | |
"owners": [ | |
"099720109477" | |
] | |
}, | |
"ssh_username": "ubuntu", | |
"subnet_id": "*subnet*", | |
"tags": { | |
"BuildRegion": "{{ .BuildRegion }}", | |
"SourceAMI": "{{ .SourceAMI }}" | |
}, | |
"type": "amazon-ebs", | |
"vpc_id": "*vpc*" | |
}], | |
"post-processors": [{ | |
"output": "manifest.json", | |
"strip_path": true, | |
"type": "manifest" | |
}], | |
"provisioners": [{ | |
"destination": "/tmp/prepare.sh", | |
"source": "usr/local/bin/prepare.sh", | |
"type": "file" | |
}, | |
{ | |
"destination": "/tmp/chef-solo.service", | |
"source": "etc/chef-solo.service", | |
"type": "file" | |
}, | |
{ | |
"inline": [ | |
"sudo chown root:root /tmp/prepare.sh \u0026\u0026 sudo chmod +x /tmp/prepare.sh", | |
"sudo mv /tmp/prepare.sh /usr/local/bin", | |
"sudo chown root:root /tmp/chef-solo.service \u0026\u0026 sudo mv /tmp/chef-solo.service /etc/systemd/system/" | |
], | |
"type": "shell" | |
}, | |
{ | |
"inline": [ | |
"sudo apt-get update", | |
"sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" dist-upgrade", | |
"sudo sed -i '/^GRUB\\_CMDLINE\\_LINUX/s/\\\"$/\\ net\\.ifnames\\=0\\\"/' /etc/default/grub", | |
"sudo update-grub" | |
], | |
"pause_before": "60s", | |
"type": "shell" | |
}, | |
{ | |
"command": "berks vendor .vendor", | |
"type": "shell-local" | |
}, | |
{ | |
"cookbook_paths": [ | |
".vendor" | |
], | |
"install_command": "curl -L https://omnitruck.chef.io/install.sh | sudo bash -s -- -v 13.3.42", | |
"json": { | |
"run_list": [ | |
"recipe[*]", | |
"recipe[*]", | |
"recipe[*]", | |
"recipe[*]", | |
"recipe[*]", | |
"recipe[*]" | |
], | |
"stage": { | |
"env": "*", | |
"name": "*" | |
} | |
}, | |
"roles_path": "roles", | |
"type": "chef-solo" | |
}, | |
{ | |
"inline": [ | |
"sudo reboot now" | |
], | |
"type": "shell" | |
}, | |
{ | |
"inline": [ | |
"sudo systemctl enable /etc/systemd/system/chef-solo.service" | |
], | |
"pause_before": "120s", | |
"type": "shell" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment