Ivan Berezovskiy | c46e7c0 | 2018-10-29 18:22:09 +0400 | [diff] [blame] | 1 | { |
| 2 | "variables": { |
| 3 | "user": "root", |
| 4 | "password": "r00tme", |
| 5 | "images_cache": "{{ env `PACKER_IMAGES_CACHE` }}", |
| 6 | "disk_size": "50000", |
| 7 | "do_api_token": "{{ env `DO_API_TOKEN` }}", |
| 8 | "image_name": "{{ env `IMAGE_NAME` }}", |
| 9 | "cluster_model": "{{ env `CLUSTER_MODEL` }}", |
| 10 | "cluster_model_ref": "{{ env `CLUSTER_MODEL_REF` }}", |
| 11 | "cluster_name": "{{ env `CLUSTER_NAME` }}", |
| 12 | "bs_hostname": "cfg01", |
| 13 | "formula_version": "{{ env `FORMULA_VERSION` }}", |
| 14 | "mcp_version": "{{ env `MCP_VERSION` }}", |
| 15 | "ubuntu_baseurl": "{{ env `UBUNTU_BASEURL` }}", |
| 16 | "saltstack_gpg": "{{ env `SALTSTACK_GPG` }}", |
| 17 | "saltstack_repo": "{{ env `SALTSTACK_REPO` }}", |
| 18 | "apt_mirantis_gpg": "{{ env `APT_MIRANTIS_GPG` }}", |
| 19 | "apt_mirantis_salt_repo": "{{ env `APT_MIRANTIS_SALT_REPO` }}", |
| 20 | "git_salt_formulas_scripts": "{{ env `GIT_SALT_FORMULAS_SCRIPTS` }}", |
| 21 | "apt_repository": "{{ env `APT_REPOSITORY` }}", |
| 22 | "apt_repository_gpg": "{{ env `APT_REPOSITORY_GPG` }}" |
| 23 | }, |
| 24 | "provisioners": [ |
| 25 | { |
| 26 | "type": "file", |
| 27 | "source": "files/root/", |
| 28 | "destination": "/root" |
| 29 | }, |
| 30 | { |
| 31 | "type": "file", |
| 32 | "source": "files/opt/bootstrap.saltstack.com.sh", |
| 33 | "destination": "/opt/bootstrap.saltstack.com.sh" |
| 34 | }, |
| 35 | { |
| 36 | "environment_vars": [ |
| 37 | "UBUNTU_BASEURL={{ user `ubuntu_baseurl` }}", |
| 38 | "PACKER_OFFLINE_BUILD=true" |
| 39 | ], |
| 40 | "type": "shell", |
| 41 | "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", |
| 42 | "expect_disconnect": "true", |
| 43 | "scripts": [ |
| 44 | "scripts/base_set_hostname.sh", |
| 45 | "scripts/base.sh", |
| 46 | "scripts/motd.sh", |
| 47 | "scripts/network.sh", |
| 48 | "scripts/reboot.sh" |
| 49 | ] |
| 50 | }, |
| 51 | { |
| 52 | "environment_vars": [ |
| 53 | "CLUSTER_MODEL={{ user `cluster_model` }}", |
| 54 | "CLUSTER_MODEL_REF={{ user `cluster_model_ref` }}", |
| 55 | "CLUSTER_NAME={{ user `cluster_name` }}", |
| 56 | "BS_HOSTNAME={{ user `bs_hostname` }}", |
| 57 | "FORMULA_VERSION={{ user `formula_version` }}", |
| 58 | "SALTSTACK_GPG={{ user `saltstack_gpg` }}", |
| 59 | "SALTSTACK_REPO={{ user `saltstack_repo` }}", |
| 60 | "APT_MIRANTIS_GPG={{ user `apt_mirantis_gpg` }}", |
| 61 | "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}", |
| 62 | "GIT_SALT_FORMULAS_SCRIPTS={{ user `git_salt_formulas_scripts` }}", |
| 63 | "APT_REPOSITORY={{ user `apt_repository` }}", |
| 64 | "APT_REPOSITORY_GPG={{ user `apt_repository_gpg` }}", |
| 65 | "FORMULA_VERSION={{ user `formula_version` }}", |
| 66 | "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}", |
| 67 | "BOOTSTRAP_SALTSTACK_COM=file:///opt/bootstrap.saltstack.com.sh", |
| 68 | "PACKER_OFFLINE_BUILD=true" |
| 69 | ], |
| 70 | "type": "shell", |
| 71 | "pause_before": "60s", |
| 72 | "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", |
| 73 | "expect_disconnect": "true", |
| 74 | "scripts": [ |
| 75 | "scripts/salt_bootstrap.sh", |
| 76 | "scripts/salt.sh" |
| 77 | ] |
| 78 | }, |
| 79 | { |
| 80 | "environment_vars": [ |
| 81 | "HOME=/root", |
| 82 | "MCP_VERSION={{ user `mcp_version` }}" |
| 83 | ], |
| 84 | "type": "shell", |
| 85 | "pause_before": "10s", |
| 86 | "scripts": [ |
| 87 | "scripts/security.sh", |
| 88 | "scripts/info.sh", |
| 89 | "scripts/zerodisk.sh" |
| 90 | ] |
| 91 | }, |
| 92 | { |
| 93 | "type": "file", |
| 94 | "source": "files/etc/", |
| 95 | "destination": "/etc" |
| 96 | } |
| 97 | ], |
| 98 | "builders": [ |
| 99 | { |
| 100 | "type": "qemu", |
| 101 | "qemuargs": [ |
| 102 | [ |
| 103 | "-m", |
| 104 | "8096M" |
| 105 | ], |
| 106 | [ |
| 107 | "-fda", |
| 108 | "config-drive/cloudata.iso" |
| 109 | ], |
| 110 | [ |
| 111 | "-smp", |
| 112 | "4" |
| 113 | ] |
| 114 | ], |
| 115 | "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}", |
| 116 | "output_directory": "images/{{ user `image_name` }}-qemu-{{ isotime \"200601021504\" }}", |
| 117 | "format": "qcow2", |
| 118 | "disk_compression": true, |
| 119 | "iso_checksum": "566efef1d6f12e7d3a994c2405bdb642", |
| 120 | "iso_checksum_type": "md5", |
| 121 | "iso_url": "http://cloud-images.ubuntu.com/releases/xenial/release-20180306/ubuntu-16.04-server-cloudimg-amd64-disk1.img", |
| 122 | "iso_target_path": "{{ user `images_cache`}}/release-20180306_xenial-server-cloudimg-amd64-disk1.img", |
| 123 | "disk_image": true, |
| 124 | "accelerator": "kvm", |
| 125 | "disk_size": "{{ user `disk_size`}}", |
| 126 | "headless": true, |
| 127 | "ssh_username": "{{user `user`}}", |
| 128 | "ssh_password": "{{user `password`}}", |
| 129 | "ssh_host_port_min": 7000, |
| 130 | "ssh_host_port_max": 7050, |
| 131 | "shutdown_command": "shutdown -P now", |
| 132 | "boot_wait": "2s", |
| 133 | "ssh_wait_timeout": "360s" |
| 134 | } |
| 135 | ] |
| 136 | } |