Last active
September 26, 2021 07:53
-
-
Save ru-rocker/9a0eda3c469029d6f92c005ccf714201 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
packer { | |
required_plugins { | |
amazon = { | |
version = ">= 0.0.2" | |
source = "github.com/hashicorp/amazon" | |
} | |
} | |
} | |
source "amazon-ebs" "centos7" { | |
ami_name = "packer-centos7-aws" | |
instance_type = "t2.micro" | |
region = "ap-southeast-1" | |
associate_public_ip_address = true | |
source_ami_filter { | |
filters = { | |
name = "your-company-base-centos7-image*" | |
architecture = "x86_64" | |
root-device-type = "ebs" | |
virtualization-type = "hvm" | |
} | |
most_recent = true | |
owners = ["XXXXXXXX"] | |
} | |
ssh_username = "centos" | |
} | |
build { | |
name = "packer-centos7-aws" | |
sources = [ | |
"source.amazon-ebs.centos7" | |
] | |
provisioner "shell" { | |
environment_vars = [ | |
"https_proxy=http://yourproxyserver:port", | |
] | |
inline = [ | |
"echo update yum", | |
"sudo yum update -y", | |
"echo Installing JDK", | |
"sudo yum install -y java-11-openjdk-devel", | |
] | |
} | |
} | |
This file contains hidden or 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
inline = [ | |
"sudo echo proxy='http://yourproxyserver:port' >> /etc/yum.conf", | |
# and the rest | |
] |
This file contains hidden or 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
inline = [ | |
"sudo bash -c \"echo proxy='http://yourproxyserver:port' >> /etc/yum.conf\"", | |
# and the rest | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment