This commit is contained in:
4
packer/ami/OWNERS
Normal file
4
packer/ami/OWNERS
Normal file
@ -0,0 +1,4 @@
|
||||
# See the OWNERS docs at https://go.k8s.io/owners
|
||||
|
||||
approvers:
|
||||
- cluster-api-aws-maintainers
|
11
packer/ami/amazon-2.json
Normal file
11
packer/ami/amazon-2.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"ami_filter_name": "amzn2-ami-hvm-2*",
|
||||
"ami_filter_owners": "amazon",
|
||||
"build_name": "amazon-2",
|
||||
"distribution": "Amazon Linux",
|
||||
"distribution_release": "Amazon Linux 2",
|
||||
"distribution_version": "2",
|
||||
"root_device_name": "/dev/xvda",
|
||||
"source_ami": "",
|
||||
"ssh_username": "ec2-user"
|
||||
}
|
11
packer/ami/centos-7.json
Normal file
11
packer/ami/centos-7.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"ami_filter_name": "CentOS Linux 7 x86_64 HVM EBS ENA*",
|
||||
"ami_filter_owners": "461800378586",
|
||||
"build_name": "centos-7",
|
||||
"distribution": "CentOS",
|
||||
"distribution_release": "Core",
|
||||
"distribution_version": "7",
|
||||
"root_device_name": "/dev/sda1",
|
||||
"source_ami": "",
|
||||
"ssh_username": "centos"
|
||||
}
|
17
packer/ami/flatcar.json
Normal file
17
packer/ami/flatcar.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"ami_filter_name": "Flatcar*{{env `FLATCAR_CHANNEL`}}*",
|
||||
"ami_filter_owners": "075585003325",
|
||||
"ansible_extra_vars": "ansible_python_interpreter=/opt/bin/python",
|
||||
"build_name": "flatcar-{{env `FLATCAR_CHANNEL`}}",
|
||||
"crictl_source_type": "http",
|
||||
"distribution": "flatcar",
|
||||
"kubernetes_cni_source_type": "http",
|
||||
"kubernetes_source_type": "http",
|
||||
"python_path": "/opt/bin/builder-env/site-packages",
|
||||
"root_device_name": "/dev/xvda",
|
||||
"ssh_username": "core",
|
||||
"systemd_prefix": "/etc/systemd",
|
||||
"sysusr_prefix": "/opt",
|
||||
"sysusrlocal_prefix": "/opt",
|
||||
"user_data": ""
|
||||
}
|
208
packer/ami/packer-windows.json
Normal file
208
packer/ami/packer-windows.json
Normal file
@ -0,0 +1,208 @@
|
||||
{
|
||||
"builders": [
|
||||
{
|
||||
"access_key": "{{user `aws_access_key`}}",
|
||||
"ami_description": "{{user `ami_description`}}",
|
||||
"ami_groups": "{{user `ami_groups`}}",
|
||||
"ami_name": "capa-ami-{{user `build_name`}}-{{user `kubernetes_semver` | clean_resource_name}}-{{user `build_timestamp`}}",
|
||||
"ami_product_codes": "",
|
||||
"ami_regions": "{{user `ami_regions`}}",
|
||||
"ami_users": "{{user `ami_users`}}",
|
||||
"associate_public_ip_address": true,
|
||||
"communicator": "winrm",
|
||||
"disable_stop_instance": true,
|
||||
"encrypt_boot": "{{user `encrypted`}}",
|
||||
"iam_instance_profile": "{{user `iam_instance_profile`}}",
|
||||
"instance_type": "{{user `builder_instance_type`}}",
|
||||
"kms_key_id": "{{user `kms_key_id`}}",
|
||||
"launch_block_device_mappings": [
|
||||
{
|
||||
"delete_on_termination": true,
|
||||
"device_name": "{{ user `root_device_name` }}",
|
||||
"throughput": "{{ user `throughput` }}",
|
||||
"volume_size": "{{ user `volume_size` }}",
|
||||
"volume_type": "{{ user `volume_type` }}"
|
||||
}
|
||||
],
|
||||
"name": "{{user `build_name`}}",
|
||||
"profile": "{{ user `aws_profile`}}",
|
||||
"region": "{{ user `aws_region` }}",
|
||||
"secret_key": "{{user `aws_secret_key`}}",
|
||||
"security_group_ids": "{{user `aws_security_group_ids`}}",
|
||||
"skip_create_ami": "{{ user `skip_create_ami`}}",
|
||||
"skip_profile_validation": "{{user `skip_profile_validation`}}",
|
||||
"snapshot_groups": "{{user `snapshot_groups`}}",
|
||||
"snapshot_users": "{{user `snapshot_users`}}",
|
||||
"source_ami": "{{user `source_ami`}}",
|
||||
"source_ami_filter": {
|
||||
"filters": {
|
||||
"architecture": "x86_64",
|
||||
"name": "{{user `ami_filter_name`}}",
|
||||
"root-device-type": "ebs",
|
||||
"virtualization-type": "hvm"
|
||||
},
|
||||
"most_recent": true,
|
||||
"owners": "{{user `ami_filter_owners`}}"
|
||||
},
|
||||
"ssh_keypair_name": "{{user `ssh_keypair_name`}}",
|
||||
"ssh_private_key_file": "{{user `ssh_private_key_file`}}",
|
||||
"subnet_id": "{{ user `subnet_id` }}",
|
||||
"tags": {
|
||||
"build_date": "{{isotime}}",
|
||||
"build_timestamp": "{{user `build_timestamp`}}",
|
||||
"containerd_version": "{{user `containerd_version`}}",
|
||||
"distribution": "{{user `distribution`}}",
|
||||
"distribution_version": "{{user `distribution_version`}}",
|
||||
"image_builder_version": "{{user `ib_version`}}",
|
||||
"kubernetes_cni_version": "{{user `kubernetes_cni_semver`}}",
|
||||
"kubernetes_version": "{{user `kubernetes_semver`}}",
|
||||
"source_ami": "{{user `source_ami`}}"
|
||||
},
|
||||
"temporary_security_group_source_cidrs": "{{ user `temporary_security_group_source_cidrs` }}",
|
||||
"token": "{{ user `aws_session_token` }}",
|
||||
"type": "amazon-ebs",
|
||||
"user_data_file": "packer/ami/scripts/winrm_bootstrap.txt",
|
||||
"vpc_id": "{{ user `vpc_id` }}",
|
||||
"winrm_insecure": true,
|
||||
"winrm_timeout": "6m",
|
||||
"winrm_use_ssl": true,
|
||||
"winrm_username": "Administrator"
|
||||
}
|
||||
],
|
||||
"post-processors": [
|
||||
{
|
||||
"custom_data": {
|
||||
"containerd_version": "{{user `containerd_version`}}",
|
||||
"kubernetes_cni_version": "{{user `kubernetes_cni_semver`}}",
|
||||
"kubernetes_version": "{{user `kubernetes_semver`}}"
|
||||
},
|
||||
"output": "{{user `manifest_output`}}",
|
||||
"type": "manifest"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"extra_arguments": [
|
||||
"-e",
|
||||
"ansible_winrm_server_cert_validation=ignore",
|
||||
"--extra-vars",
|
||||
"{{user `ansible_common_vars`}}",
|
||||
"--extra-vars",
|
||||
"{{user `ansible_extra_vars`}}",
|
||||
"--extra-vars",
|
||||
"{{user `ansible_user_vars`}}"
|
||||
],
|
||||
"playbook_file": "ansible/windows/node_windows.yml",
|
||||
"type": "ansible",
|
||||
"use_proxy": false,
|
||||
"user": "Administrator"
|
||||
},
|
||||
{
|
||||
"restart_timeout": "10m",
|
||||
"type": "windows-restart"
|
||||
},
|
||||
{
|
||||
"arch": "{{user `goss_arch`}}",
|
||||
"download_path": "{{user `goss_download_path`}}",
|
||||
"format": "{{user `goss_format`}}",
|
||||
"format_options": "{{user `goss_format_options`}}",
|
||||
"goss_file": "{{user `goss_entry_file`}}",
|
||||
"inspect": "{{user `goss_inspect_mode`}}",
|
||||
"remote_folder": "{{user `goss_remote_folder`}}",
|
||||
"remote_path": "{{user `goss_remote_path`}}",
|
||||
"skip_install": "{{user `goss_skip_install`}}",
|
||||
"target_os": "Windows",
|
||||
"tests": [
|
||||
"{{user `goss_tests_dir`}}"
|
||||
],
|
||||
"type": "goss",
|
||||
"url": "{{user `goss_url`}}",
|
||||
"use_sudo": false,
|
||||
"vars_env": {
|
||||
"GOSS_MAX_CONCURRENT": "1",
|
||||
"GOSS_USE_ALPHA": "1"
|
||||
},
|
||||
"vars_file": "{{user `goss_vars_file`}}",
|
||||
"vars_inline": {
|
||||
"OS": "{{user `distribution` | lower}}",
|
||||
"PROVIDER": "amazon",
|
||||
"containerd_version": "{{user `containerd_version`}}",
|
||||
"distribution_version": "{{user `distribution_version`}}",
|
||||
"docker_ee_version": "{{user `docker_ee_version`}}",
|
||||
"kubernetes_version": "{{user `kubernetes_semver`}}",
|
||||
"pause_image": "{{user `pause_image`}}",
|
||||
"runtime": "{{user `runtime`}}",
|
||||
"ssh_source_url": "{{user `ssh_source_url`}}"
|
||||
},
|
||||
"version": "{{user `goss_version`}}"
|
||||
},
|
||||
{
|
||||
"inline": [
|
||||
"rm -Force -Recurse C:\\var\\log\\kubelet\\*"
|
||||
],
|
||||
"type": "powershell"
|
||||
},
|
||||
{
|
||||
"elevated_password": "{{.WinRMPassword}}",
|
||||
"elevated_user": "Administrator",
|
||||
"script": "packer/ami/scripts/sysprep_prerequisites.ps1",
|
||||
"type": "powershell"
|
||||
},
|
||||
{
|
||||
"inline": [
|
||||
"C:/ProgramData/Amazon/EC2-Windows/Launch/Scripts/SysprepInstance.ps1"
|
||||
],
|
||||
"type": "powershell"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"additional_debug_files": null,
|
||||
"ami_description": "Cluster API base image designed for {{user `kubernetes_semver`}}",
|
||||
"ami_groups": "all",
|
||||
"ami_regions": "ap-south-1,eu-west-3,eu-west-2,eu-west-1,ap-northeast-2,ap-northeast-1,sa-east-1,ca-central-1,ap-southeast-1,ap-southeast-2,eu-central-1,us-east-1,us-east-2,us-west-1,us-west-2",
|
||||
"ami_users": "",
|
||||
"ansible_common_vars": "",
|
||||
"ansible_extra_vars": "",
|
||||
"ansible_user_vars": "",
|
||||
"aws_access_key": "",
|
||||
"aws_profile": "",
|
||||
"aws_region": "us-east-1",
|
||||
"aws_secret_key": "",
|
||||
"aws_security_group_ids": "",
|
||||
"aws_session_token": "",
|
||||
"build_name": null,
|
||||
"build_timestamp": "{{timestamp}}",
|
||||
"builder_instance_type": "t3.large",
|
||||
"cloudbase_init_url": "https://github.com/cloudbase/cloudbase-init/releases/download/{{user `cloudbase_init_version`}}/CloudbaseInitSetup_{{user `cloudbase_init_version` | replace_all `.` `_` }}_x64.msi",
|
||||
"cloudbase_metadata_services": "cloudbaseinit.metadata.services.ec2service.EC2Service",
|
||||
"cloudbase_metadata_services_unattend": "cloudbaseinit.metadata.services.base.EmptyMetadataService",
|
||||
"cloudbase_plugins": "cloudbaseinit.plugins.windows.createuser.CreateUserPlugin, cloudbaseinit.plugins.common.setuserpassword.SetUserPasswordPlugin, cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin, cloudbaseinit.plugins.common.ephemeraldisk.EphemeralDiskPlugin, cloudbaseinit.plugins.common.mtu.MTUPlugin, cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin, cloudbaseinit.plugins.common.sshpublickeys.SetUserSSHPublicKeysPlugin",
|
||||
"cloudbase_plugins_unattend": "cloudbaseinit.plugins.common.mtu.MTUPlugin",
|
||||
"containerd_sha256": null,
|
||||
"containerd_url": "",
|
||||
"containerd_version": null,
|
||||
"encrypted": "false",
|
||||
"iam_instance_profile": "",
|
||||
"ib_version": "{{env `IB_VERSION`}}",
|
||||
"kms_key_id": "",
|
||||
"kubernetes_base_url": "https://kubernetesreleases.blob.core.windows.net/kubernetes/{{user `kubernetes_semver`}}/binaries/node/windows/{{user `kubernetes_goarch`}}",
|
||||
"manifest_output": "manifest.json",
|
||||
"nssm_url": null,
|
||||
"prepull": null,
|
||||
"skip_create_ami": "false",
|
||||
"skip_profile_validation": "false",
|
||||
"snapshot_groups": "all",
|
||||
"snapshot_users": "",
|
||||
"ssh_keypair_name": "",
|
||||
"ssh_private_key_file": "",
|
||||
"subnet_id": "",
|
||||
"temporary_security_group_source_cidrs": "",
|
||||
"throughput": "125",
|
||||
"volume_size": "40",
|
||||
"volume_type": "gp3",
|
||||
"vpc_id": "",
|
||||
"windows_service_manager": null,
|
||||
"windows_updates_kbs": null,
|
||||
"wins_url": "https://github.com/rancher/wins/releases/download/v{{user `wins_version`}}/wins.exe"
|
||||
}
|
||||
}
|
210
packer/ami/packer.json
Normal file
210
packer/ami/packer.json
Normal file
@ -0,0 +1,210 @@
|
||||
{
|
||||
"builders": [
|
||||
{
|
||||
"access_key": "{{user `aws_access_key`}}",
|
||||
"ami_description": "{{user `ami_description`}}",
|
||||
"ami_groups": "{{user `ami_groups`}}",
|
||||
"ami_name": "capa-ami-{{user `build_name`}}-{{user `kubernetes_semver` | clean_resource_name}}-{{user `build_timestamp`}}",
|
||||
"ami_product_codes": "",
|
||||
"ami_regions": "{{user `ami_regions`}}",
|
||||
"ami_users": "{{user `ami_users`}}",
|
||||
"encrypt_boot": "{{user `encrypted`}}",
|
||||
"iam_instance_profile": "{{user `iam_instance_profile`}}",
|
||||
"instance_type": "{{user `builder_instance_type`}}",
|
||||
"kms_key_id": "{{user `kms_key_id`}}",
|
||||
"launch_block_device_mappings": [
|
||||
{
|
||||
"delete_on_termination": true,
|
||||
"device_name": "{{ user `root_device_name` }}",
|
||||
"iops": "{{ user `iops`}}",
|
||||
"throughput": "{{ user `throughput` }}",
|
||||
"volume_size": "{{ user `volume_size` }}",
|
||||
"volume_type": "{{ user `volume_type` }}"
|
||||
}
|
||||
],
|
||||
"name": "{{user `build_name`}}",
|
||||
"profile": "{{ user `aws_profile`}}",
|
||||
"region": "{{ user `aws_region` }}",
|
||||
"secret_key": "{{user `aws_secret_key`}}",
|
||||
"security_group_ids": "{{user `aws_security_group_ids`}}",
|
||||
"skip_create_ami": "{{ user `skip_create_ami`}}",
|
||||
"skip_profile_validation": "{{user `skip_profile_validation`}}",
|
||||
"snapshot_groups": "{{user `snapshot_groups`}}",
|
||||
"snapshot_users": "{{user `snapshot_users`}}",
|
||||
"source_ami": "{{user `source_ami`}}",
|
||||
"source_ami_filter": {
|
||||
"filters": {
|
||||
"architecture": "x86_64",
|
||||
"name": "{{user `ami_filter_name`}}",
|
||||
"root-device-type": "ebs",
|
||||
"virtualization-type": "hvm"
|
||||
},
|
||||
"most_recent": true,
|
||||
"owners": "{{user `ami_filter_owners`}}"
|
||||
},
|
||||
"ssh_keypair_name": "{{user `ssh_keypair_name`}}",
|
||||
"ssh_private_key_file": "{{user `ssh_private_key_file`}}",
|
||||
"ssh_username": "{{user `ssh_username`}}",
|
||||
"subnet_id": "{{ user `subnet_id` }}",
|
||||
"tags": {
|
||||
"build_date": "{{isotime}}",
|
||||
"build_timestamp": "{{user `build_timestamp`}}",
|
||||
"containerd_version": "{{user `containerd_version`}}",
|
||||
"distribution": "{{user `distribution`}}",
|
||||
"distribution_release": "{{user `distribution_release`}}",
|
||||
"distribution_version": "{{user `distribution_version`}}",
|
||||
"image_builder_version": "{{user `ib_version`}}",
|
||||
"kubernetes_cni_version": "{{user `kubernetes_cni_semver`}}",
|
||||
"kubernetes_version": "{{user `kubernetes_semver`}}",
|
||||
"source_ami": "{{user `source_ami`}}"
|
||||
},
|
||||
"temporary_security_group_source_cidrs": "{{ user `temporary_security_group_source_cidrs` }}",
|
||||
"token": "{{ user `aws_session_token` }}",
|
||||
"type": "amazon-ebs",
|
||||
"user_data": "{{ user `user_data` }}",
|
||||
"vpc_id": "{{ user `vpc_id` }}"
|
||||
}
|
||||
],
|
||||
"post-processors": [
|
||||
{
|
||||
"custom_data": {
|
||||
"containerd_version": "{{user `containerd_version`}}",
|
||||
"kubernetes_cni_version": "{{user `kubernetes_cni_semver`}}",
|
||||
"kubernetes_version": "{{user `kubernetes_semver`}}"
|
||||
},
|
||||
"output": "{{user `manifest_output`}}",
|
||||
"type": "manifest"
|
||||
}
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"environment_vars": [
|
||||
"BUILD_NAME={{user `build_name`}}"
|
||||
],
|
||||
"inline": [
|
||||
"if [ $BUILD_NAME != \"ubuntu-1804\" ]; then exit 0; fi",
|
||||
"while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done",
|
||||
"sudo apt-get -qq update && sudo DEBIAN_FRONTEND=noninteractive apt-get -qqy install python python-pip"
|
||||
],
|
||||
"type": "shell"
|
||||
},
|
||||
{
|
||||
"execute_command": "BUILD_NAME={{user `build_name`}}; if [[ \"${BUILD_NAME}\" == *\"flatcar\"* ]]; then sudo {{.Vars}} -S -E bash '{{.Path}}'; fi",
|
||||
"script": "./packer/files/flatcar/scripts/bootstrap-flatcar.sh",
|
||||
"type": "shell"
|
||||
},
|
||||
{
|
||||
"ansible_env_vars": [
|
||||
"ANSIBLE_SSH_ARGS='{{user `existing_ansible_ssh_args`}} {{user `ansible_common_ssh_args`}}'"
|
||||
],
|
||||
"extra_arguments": [
|
||||
"--extra-vars",
|
||||
"{{user `ansible_common_vars`}}",
|
||||
"--extra-vars",
|
||||
"{{user `ansible_extra_vars`}}",
|
||||
"--extra-vars",
|
||||
"{{user `ansible_user_vars`}}",
|
||||
"--scp-extra-args",
|
||||
"{{user `ansible_scp_extra_args`}}"
|
||||
],
|
||||
"playbook_file": "./ansible/node.yml",
|
||||
"type": "ansible"
|
||||
},
|
||||
{
|
||||
"arch": "{{user `goss_arch`}}",
|
||||
"download_path": "{{user `goss_download_path`}}",
|
||||
"format": "{{user `goss_format`}}",
|
||||
"format_options": "{{user `goss_format_options`}}",
|
||||
"goss_file": "{{user `goss_entry_file`}}",
|
||||
"inspect": "{{user `goss_inspect_mode`}}",
|
||||
"remote_folder": "{{user `goss_remote_folder`}}",
|
||||
"remote_path": "{{user `goss_remote_path`}}",
|
||||
"skip_install": "{{user `goss_skip_install`}}",
|
||||
"tests": [
|
||||
"{{user `goss_tests_dir`}}"
|
||||
],
|
||||
"type": "goss",
|
||||
"url": "{{user `goss_url`}}",
|
||||
"use_sudo": true,
|
||||
"vars_file": "{{user `goss_vars_file`}}",
|
||||
"vars_inline": {
|
||||
"ARCH": "amd64",
|
||||
"OS": "{{user `distribution` | lower}}",
|
||||
"OS_VERSION": "{{user `distribution_version` | lower}}",
|
||||
"PROVIDER": "amazon",
|
||||
"containerd_version": "{{user `containerd_version`}}",
|
||||
"kubernetes_cni_deb_version": "{{ user `kubernetes_cni_deb_version` }}",
|
||||
"kubernetes_cni_rpm_version": "{{ split (user `kubernetes_cni_rpm_version`) \"-\" 0 }}",
|
||||
"kubernetes_cni_source_type": "{{user `kubernetes_cni_source_type`}}",
|
||||
"kubernetes_cni_version": "{{user `kubernetes_cni_semver` | replace \"v\" \"\" 1}}",
|
||||
"kubernetes_deb_version": "{{ user `kubernetes_deb_version` }}",
|
||||
"kubernetes_rpm_version": "{{ split (user `kubernetes_rpm_version`) \"-\" 0 }}",
|
||||
"kubernetes_source_type": "{{user `kubernetes_source_type`}}",
|
||||
"kubernetes_version": "{{user `kubernetes_semver` | replace \"v\" \"\" 1}}"
|
||||
},
|
||||
"version": "{{user `goss_version`}}"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"amazon_ssm_agent_rpm": "https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm",
|
||||
"ami_description": "Cluster API base image designed for {{user `kubernetes_semver`}}",
|
||||
"ami_groups": "all",
|
||||
"ami_regions": "ap-south-1,eu-west-3,eu-west-2,eu-west-1,ap-northeast-2,ap-northeast-1,sa-east-1,ca-central-1,ap-southeast-1,ap-southeast-2,eu-central-1,us-east-1,us-east-2,us-west-1,us-west-2",
|
||||
"ami_users": "",
|
||||
"ansible_common_vars": "",
|
||||
"ansible_extra_vars": "",
|
||||
"ansible_scp_extra_args": "",
|
||||
"ansible_user_vars": "",
|
||||
"aws_access_key": "",
|
||||
"aws_profile": "",
|
||||
"aws_region": "us-east-1",
|
||||
"aws_secret_key": "",
|
||||
"aws_security_group_ids": "",
|
||||
"aws_session_token": "",
|
||||
"build_timestamp": "{{timestamp}}",
|
||||
"builder_instance_type": "t3.small",
|
||||
"containerd_sha256": null,
|
||||
"containerd_url": "https://github.com/containerd/containerd/releases/download/v{{user `containerd_version`}}/cri-containerd-cni-{{user `containerd_version`}}-linux-amd64.tar.gz",
|
||||
"containerd_version": null,
|
||||
"crictl_url": "https://github.com/kubernetes-sigs/cri-tools/releases/download/v{{user `crictl_version`}}/crictl-v{{user `crictl_version`}}-linux-amd64.tar.gz",
|
||||
"crictl_version": null,
|
||||
"encrypted": "false",
|
||||
"existing_ansible_ssh_args": "{{env `ANSIBLE_SSH_ARGS`}}",
|
||||
"iam_instance_profile": "",
|
||||
"ib_version": "{{env `IB_VERSION`}}",
|
||||
"iops": "3000",
|
||||
"kms_key_id": "",
|
||||
"kubernetes_cni_deb_version": null,
|
||||
"kubernetes_cni_http_source": null,
|
||||
"kubernetes_cni_rpm_version": null,
|
||||
"kubernetes_cni_semver": null,
|
||||
"kubernetes_cni_source_type": null,
|
||||
"kubernetes_container_registry": null,
|
||||
"kubernetes_deb_gpg_key": null,
|
||||
"kubernetes_deb_repo": null,
|
||||
"kubernetes_deb_version": null,
|
||||
"kubernetes_http_source": null,
|
||||
"kubernetes_load_additional_imgs": null,
|
||||
"kubernetes_rpm_gpg_check": null,
|
||||
"kubernetes_rpm_gpg_key": null,
|
||||
"kubernetes_rpm_repo": null,
|
||||
"kubernetes_rpm_version": null,
|
||||
"kubernetes_semver": null,
|
||||
"kubernetes_source_type": null,
|
||||
"manifest_output": "manifest.json",
|
||||
"python_path": "",
|
||||
"skip_create_ami": "false",
|
||||
"skip_profile_validation": "false",
|
||||
"snapshot_groups": "all",
|
||||
"snapshot_users": "",
|
||||
"ssh_keypair_name": "",
|
||||
"ssh_private_key_file": "",
|
||||
"subnet_id": "",
|
||||
"temporary_security_group_source_cidrs": "",
|
||||
"throughput": "125",
|
||||
"user_data": "#cloud-config\nrepo_upgrade: none",
|
||||
"volume_size": "8",
|
||||
"volume_type": "gp3",
|
||||
"vpc_id": ""
|
||||
}
|
||||
}
|
15
packer/ami/rhel-8.json
Normal file
15
packer/ami/rhel-8.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"ami_filter_name": "RHEL-8.6.0_HVM-*",
|
||||
"ami_filter_owners": "309956199498",
|
||||
"build_name": "rhel-8",
|
||||
"builder_instance_type": "m5.large",
|
||||
"distribution": "rhel",
|
||||
"distribution_release": "Enterprise",
|
||||
"distribution_version": "8",
|
||||
"epel_rpm_gpg_key": "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8",
|
||||
"redhat_epel_rpm": "https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm",
|
||||
"root_device_name": "/dev/sda1",
|
||||
"source_ami": "",
|
||||
"ssh_username": "ec2-user",
|
||||
"volume_size": "10"
|
||||
}
|
14
packer/ami/rockylinux-8.json
Normal file
14
packer/ami/rockylinux-8.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"ami_filter_name": "Rocky-8-ec2-8.5-*",
|
||||
"ami_filter_owners": "679593333241",
|
||||
"build_name": "rockylinux-8",
|
||||
"distribution": "rockylinux",
|
||||
"distribution_release": "Core",
|
||||
"distribution_version": "8",
|
||||
"epel_rpm_gpg_key": "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8",
|
||||
"redhat_epel_rpm": "https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm",
|
||||
"root_device_name": "/dev/sda1",
|
||||
"source_ami": "",
|
||||
"ssh_username": "rocky",
|
||||
"volume_size": "10"
|
||||
}
|
29
packer/ami/scripts/sysprep_prerequisites.ps1
Normal file
29
packer/ami/scripts/sysprep_prerequisites.ps1
Normal file
@ -0,0 +1,29 @@
|
||||
# Copyright 2020 The Kubernetes Authors.
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
Write-Output 'Removing default unattend.xml file...'
|
||||
if( Test-Path $Env:SystemRoot\system32\Sysprep\unattend.xml ) {
|
||||
Remove-Item $Env:SystemRoot\system32\Sysprep\unattend.xml -Force
|
||||
}
|
||||
|
||||
# Schedule InitializeInstance to run on next boot
|
||||
& $Env:ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeInstance.ps1 -Schedule
|
||||
|
||||
$unattendedXml = "$ENV:ProgramFiles\Cloudbase Solutions\Cloudbase-Init\conf\Unattend.xml"
|
||||
$FileExists = Test-Path $unattendedXml
|
||||
If ($FileExists -eq $True) {
|
||||
# Use the Cloudbase-init provided unattend file during install
|
||||
Write-Output "Using cloudbase-init unattend file for sysprep: $unattendedXml"
|
||||
Copy-Item -Force 'C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\Unattend.xml' $Env:ProgramData\Amazon\EC2-Windows\Launch\Sysprep\Unattend.xml
|
||||
}
|
47
packer/ami/scripts/winrm_bootstrap.txt
Normal file
47
packer/ami/scripts/winrm_bootstrap.txt
Normal file
@ -0,0 +1,47 @@
|
||||
<powershell>
|
||||
|
||||
# MAKE SURE IN YOUR PACKER CONFIG TO SET:
|
||||
#
|
||||
#
|
||||
# "winrm_username": "Administrator",
|
||||
# "winrm_insecure": true,
|
||||
# "winrm_use_ssl": true,
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
write-output "Running User Data Script"
|
||||
write-host "(host) Running User Data Script"
|
||||
|
||||
Set-ExecutionPolicy Unrestricted -Scope LocalMachine -Force -ErrorAction Ignore
|
||||
|
||||
# Don't set this before Set-ExecutionPolicy as it throws an error
|
||||
$ErrorActionPreference = "stop"
|
||||
|
||||
# Remove HTTP listener
|
||||
Remove-Item -Path WSMan:\Localhost\listener\listener* -Recurse
|
||||
|
||||
# Create a self-signed certificate to let ssl work
|
||||
$Cert = New-SelfSignedCertificate -CertstoreLocation Cert:\LocalMachine\My -DnsName "packer"
|
||||
New-Item -Path WSMan:\LocalHost\Listener -Transport HTTPS -Address * -CertificateThumbPrint $Cert.Thumbprint -Force
|
||||
|
||||
# WinRM
|
||||
write-output "Setting up WinRM"
|
||||
write-host "(host) setting up WinRM"
|
||||
|
||||
cmd.exe /c winrm quickconfig -q
|
||||
cmd.exe /c winrm set "winrm/config" '@{MaxTimeoutms="1800000"}'
|
||||
cmd.exe /c winrm set "winrm/config/winrs" '@{MaxMemoryPerShellMB="1024"}'
|
||||
cmd.exe /c winrm set "winrm/config/service" '@{AllowUnencrypted="true"}'
|
||||
cmd.exe /c winrm set "winrm/config/client" '@{AllowUnencrypted="true"}'
|
||||
cmd.exe /c winrm set "winrm/config/service/auth" '@{Basic="true"}'
|
||||
cmd.exe /c winrm set "winrm/config/client/auth" '@{Basic="true"}'
|
||||
cmd.exe /c winrm set "winrm/config/service/auth" '@{CredSSP="true"}'
|
||||
cmd.exe /c winrm set "winrm/config/listener?Address=*+Transport=HTTPS" "@{Port=`"5986`";Hostname=`"packer`";CertificateThumbprint=`"$($Cert.Thumbprint)`"}"
|
||||
cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes
|
||||
cmd.exe /c netsh firewall add portopening TCP 5986 "Port 5986"
|
||||
cmd.exe /c net stop winrm
|
||||
cmd.exe /c sc config winrm start= auto
|
||||
cmd.exe /c net start winrm
|
||||
|
||||
</powershell>
|
11
packer/ami/ubuntu-1804.json
Normal file
11
packer/ami/ubuntu-1804.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"ami_filter_name": "ubuntu/images/*ubuntu-bionic-18.04-amd64-server-*",
|
||||
"ami_filter_owners": "099720109477",
|
||||
"build_name": "ubuntu-18.04",
|
||||
"distribution": "Ubuntu",
|
||||
"distribution_release": "bionic",
|
||||
"distribution_version": "18.04",
|
||||
"root_device_name": "/dev/sda1",
|
||||
"source_ami": "",
|
||||
"ssh_username": "ubuntu"
|
||||
}
|
11
packer/ami/ubuntu-2004.json
Normal file
11
packer/ami/ubuntu-2004.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"ami_filter_name": "ubuntu/images/*ubuntu-focal-20.04-amd64-server-*",
|
||||
"ami_filter_owners": "099720109477",
|
||||
"build_name": "ubuntu-20.04",
|
||||
"distribution": "Ubuntu",
|
||||
"distribution_release": "focal",
|
||||
"distribution_version": "20.04",
|
||||
"root_device_name": "/dev/sda1",
|
||||
"source_ami": "",
|
||||
"ssh_username": "ubuntu"
|
||||
}
|
11
packer/ami/ubuntu-2204.json
Normal file
11
packer/ami/ubuntu-2204.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"ami_filter_name": "ubuntu/images/*ubuntu-jammy-22.04-amd64-server-*",
|
||||
"ami_filter_owners": "099720109477",
|
||||
"build_name": "ubuntu-22.04",
|
||||
"distribution": "Ubuntu",
|
||||
"distribution_release": "jammy",
|
||||
"distribution_version": "22.04",
|
||||
"root_device_name": "/dev/sda1",
|
||||
"source_ami": "",
|
||||
"ssh_username": "ubuntu"
|
||||
}
|
10
packer/ami/windows-2004.json
Normal file
10
packer/ami/windows-2004.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ami_filter_name": "Windows_Server-2004-English-Core-ContainersLatest-*",
|
||||
"ami_filter_owners": "amazon",
|
||||
"build_name": "windows-2004",
|
||||
"distribution": "windows",
|
||||
"distribution_version": "2004",
|
||||
"root_device_name": "/dev/sda1",
|
||||
"source_ami": "",
|
||||
"windows_updates_kbs": "KB4588962 KB2267602"
|
||||
}
|
10
packer/ami/windows-2019.json
Normal file
10
packer/ami/windows-2019.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ami_filter_name": "Windows_Server-2019-English-Full-HyperV-*",
|
||||
"ami_filter_owners": "amazon",
|
||||
"build_name": "windows-2019",
|
||||
"distribution": "windows",
|
||||
"distribution_version": "2019",
|
||||
"root_device_name": "/dev/sda1",
|
||||
"source_ami": "",
|
||||
"windows_updates_kbs": "KB4588962 KB2267602"
|
||||
}
|
Reference in New Issue
Block a user