Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Packer AWS build (CentOS6) with yum, selinux configure, edit sshd_config and delete authkey
{
"builders": [{
"type": "amazon-ebs",
"access_key": "your aws access key",
"secret_key": "your aws secret key",
"region": "us-east-1",
"source_ami": "ami-eb6b0182",
"instance_type": "t1.micro",
"ssh_username": "root",
"ssh_timeout": "5m",
"ami_name": "centos6",
"launch_block_device_mappings": [
{
"device_name": "/dev/sda",
"volume_size": 8,
"delete_on_termination": true
}
],
"ami_block_device_mappings": [
{
"device_name": "/dev/sdb",
"virtual_name": "ephemeral0"
}
],
"tags": {
"OS_Version": "CentOS6",
"Release": "Latest"
}
}],
"provisioners": [{
"type": "shell",
"inline": [
"sudo yum -y update",
"sudo resize2fs /dev/xvde",
"sudo ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime",
"sudo dd if=/dev/zero of=/var/swap.img bs=1M count=1024",
"sudo mkswap /var/swap.img",
"sudo swapon /var/swap.img",
"sudo echo \"/dev/xvdf swap swap defaults 0 0\" >> /etc/fstab",
"sudo sed -i -e \"s/^SELINUX=enforcing/SELINUX=disabled/g\" /etc/selinux/config",
"sudo sed -i -e \"s/^PasswordAuthentication yes/PasswordAuthentication no/g\" /etc/ssh/sshd_config",
"sudo rm -f /root/.ssh/authorized_keys"
]
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.