Guest User

Untitled

a guest
Aug 25th, 2019
206
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {
  2. "variables": {
  3. "ami_name": "",
  4. "build_id": "",
  5. "aws_region": "us-east-1",
  6. "copy_aws_region": "us-east-2",
  7. "ec2_instance_type": "",
  8. "instance_profile": "",
  9. "encrypt": "",
  10. "kms_cmk": "",
  11. "app_name": "base",
  12. "source_ami": "",
  13. "ssh_keypair_name": "",
  14. "ec2_key_file": "",
  15. "subnet_id": "",
  16. "availability_zone": "",
  17. "vpc_id": ""
  18. },
  19. "builders": [{
  20. "type": "amazon-ebs",
  21. "availability_zone": "{{user `availability_zone`}}",
  22. "encrypt_boot": "{{user `encrypt`}}",
  23. "kms_key_id": "{{user `kms_cmk`}}",
  24. "region": "{{user `aws_region`}}",
  25. "source_ami": "{{user `source_ami`}}",
  26. "instance_type": "{{user `ec2_instance_type`}}",
  27. "spot_price": "auto",
  28. "spot_price_auto_product": "Linux/UNIX (Amazon VPC)",
  29. "ssh_username": "ec2-user",
  30. "ssh_keypair_name" : "{{user `ssh_keypair_name`}}",
  31. "ssh_private_key_file" : "{{user `ec2_key_file`}}",
  32. "ami_name": "{{user `ami_name`}}",
  33. "iam_instance_profile": "MyPackerBuildProfile",
  34. "disable_stop_instance": "{{user `disable_instance`}}",
  35. "tags": {
  36. "Name": "packer-{{user `app_name`}}-{{user `env_name`}}",
  37. "Project": "packer",
  38. "Environment": "{{user `env_name`}}",
  39. "BuildId": "{{user `build_id`}}"
  40. },
  41. "spot_tags": {
  42. "Name": "packer-{{user `app_name`}}-{{user `env_name`}}",
  43. "Encrypted": "{{user `encrypt`}}",
  44. "ParentAmi": "{{user `source_ami`}}",
  45. "Application": "{{user `app_name`}}",
  46. "Environment": "{{user `env_name`}}",
  47. "BuildId": "{{user `build_id`}}"
  48. },
  49. "run_tags": {
  50. "Name": "packer-{{user `app_name`}}-{{user `env_name`}}",
  51. "Project": "packer",
  52. "Environment": "{{user `env_name`}}",
  53. "BuildId": "{{user `build_id`}}"
  54. },
  55. "run_volume_tags": {
  56. "Name": "packer-{{user `app_name`}}-{{user `env_name`}}",
  57. "Project": "packer",
  58. "Environment": "{{user `env_name`}}",
  59. "BuildId": "{{user `build_id`}}"
  60. },
  61. "subnet_id": "{{user `subnet_id`}}",
  62. "vpc_id": "{{user `vpc_id`}}"
  63. }],
  64. "provisioners": [
  65. {
  66. "type": "shell",
  67. "inline":[
  68. "sudo /usr/bin/pip install ansible==2.7.10"
  69. ]
  70. },
  71. {
  72. "type": "ansible-local",
  73. "playbook_file": "packer.yml",
  74. "playbook_dir": ".",
  75. "extra_arguments": [ "-e", "build_id={{user `build_id`}}", "-{{user `verbosity`}}" ]
  76. }
  77. ]
  78. }
RAW Paste Data