| { |
| "variables": { |
| "user": "root", |
| "password": "r00tme", |
| "disk_size": "60000", |
| "images_cache": "{{ env `PACKER_IMAGES_CACHE` }}", |
| "do_api_token": "{{ env `DO_API_TOKEN` }}", |
| "image_name": "{{ env `IMAGE_NAME` }}", |
| "cluster_model": "{{ env `CLUSTER_MODEL` }}", |
| "cluster_model_ref": "{{ env `CLUSTER_MODEL_REF` }}", |
| "cluster_name": "{{ env `CLUSTER_NAME` }}", |
| "bs_hostname": "apt01", |
| "mcp_version": "{{ env `MCP_VERSION` }}", |
| "ubuntu_baseurl": "{{ env `UBUNTU_BASEURL` }}", |
| "saltstack_gpg": "{{ env `SALTSTACK_GPG` }}", |
| "saltstack_repo": "{{ env `SALTSTACK_REPO` }}", |
| "apt_mirantis_gpg": "{{ env `APT_MIRANTIS_SALT_GPG` }}", |
| "apt_mirantis_salt_repo": "{{ env `APT_MIRANTIS_SALT_REPO` }}", |
| "git_salt_formulas_scripts": "{{ env `GIT_SALT_FORMULAS_SCRIPTS` }}", |
| "os_flavor": "27574e15-f031-4b78-a82d-4cef3aea9442", |
| "os_username": "{{ env `OS_USERNAME` }}", |
| "os_password": "{{ env `OS_PASSWORD` }}", |
| "os_image": "7451fac0-0ce5-4d30-ae36-cd9a90e7948e", |
| "os_endpoint": "https://cloud-cz.bud.mirantis.net:5000/v2.0", |
| "os_zone": "mcp-mk", |
| "os_floating_ip_pool": "public", |
| "os_tenant": "26e4dd19485249608ee3685f254f3909", |
| "os_network": "772f8ca6-1f4a-4535-99d0-880d6ead9a82" |
| |
| }, |
| "provisioners": [ |
| { |
| "type": "file", |
| "source": "files/root/interfaces", |
| "destination": "/root/interfaces" |
| }, |
| { |
| "type": "file", |
| "source": "files/root/minion.conf", |
| "destination": "/root/minion.conf" |
| }, |
| { |
| "type": "file", |
| "source": "files/tmp/bootstrap.saltstack.com.sh", |
| "destination": "/tmp/bootstrap.saltstack.com.sh" |
| }, |
| { |
| "environment_vars": [ |
| "CLUSTER_MODEL={{ user `cluster_model` }}", |
| "CLUSTER_MODEL_REF={{ user `cluster_model_ref` }}", |
| "CLUSTER_NAME={{ user `cluster_name` }}", |
| "BS_HOSTNAME={{ user `bs_hostname` }}", |
| "UBUNTU_BASEURL={{ user `ubuntu_baseurl` }}", |
| "SALTSTACK_GPG={{ user `saltstack_gpg` }}", |
| "SALTSTACK_REPO={{ user `saltstack_repo` }}", |
| "APT_MIRANTIS_SALT_GPG={{ user `apt_mirantis_gpg` }}", |
| "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}", |
| "GIT_SALT_FORMULAS_SCRIPTS={{ user `git_salt_formulas_scripts` }}", |
| "PACKER_OFFLINE_BUILD=true", |
| "MCP_VERSION={{ user `mcp_version` }}" |
| ], |
| "type": "shell", |
| "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}", |
| "expect_disconnect": "true", |
| "scripts": [ |
| "scripts/base.sh", |
| "scripts/motd.sh", |
| "scripts/network.sh", |
| "scripts/salt_bootstrap.sh", |
| "scripts/reboot.sh" |
| ] |
| }, |
| { |
| "environment_vars": [ |
| "APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}" |
| ], |
| "pause_before": "60s", |
| "type": "shell", |
| "expect_disconnect": "true", |
| "scripts": [ |
| "scripts/salt.sh" |
| ] |
| }, |
| { |
| "environment_vars": [ |
| "HOME=/root", |
| "MCP_VERSION={{ user `mcp_version` }}" |
| ], |
| "type": "shell", |
| "pause_before": "60s", |
| "scripts": [ |
| "scripts/mirrors.sh", |
| "scripts/security.sh", |
| "scripts/info.sh", |
| "scripts/cleanup.sh", |
| "scripts/cleanup_salt.sh" |
| ] |
| }, |
| { |
| "type": "file", |
| "source": "files/etc/cloud/cloud.cfg.d/99_tcp.cfg", |
| "destination": "/etc/cloud/cloud.cfg.d/99_tcp.cfg" |
| }, |
| { |
| "type": "file", |
| "source": "files/etc/cloud/cloud.cfg", |
| "destination": "/etc/cloud/cloud.cfg" |
| }, |
| { |
| "type": "file", |
| "source": "files/usr/local/bin/dockerswarm_cert.sh", |
| "destination": "/tmp/dockerswarm_cert.sh" |
| }, |
| { |
| "type": "shell", |
| "inline": ["mkdir -p /usr/local/bin", |
| "mv /tmp/dockerswarm_cert.sh /usr/local/bin/dockerswarm_cert.sh", |
| "chmod +x /usr/local/bin/dockerswarm_cert.sh"] |
| }, |
| { |
| "type": "file", |
| "source": "files/etc/systemd/system/dockerswarm_cert.service", |
| "destination": "/etc/systemd/system/dockerswarm_cert.service" |
| }, |
| { |
| "type": "shell", |
| "inline": ["systemctl enable dockerswarm_cert.service"] |
| }, |
| { |
| "type": "shell", |
| "pause_before": "60s", |
| "scripts": ["scripts/flush_disk.sh"] |
| } |
| ], |
| "builders": [ |
| { |
| "type": "openstack", |
| "ssh_username": "{{user `user`}}", |
| "ssh_password": "{{user `password`}}", |
| "image_name": "{{user `image_name`}}", |
| "floating_ip_pool": "{{user `os_floating_ip_pool`}}", |
| "reuse_ips": "true", |
| "source_image": "{{ user `os_image` }}", |
| "flavor": "{{ user `os_flavor` }}", |
| "user_data_file": "config-drive/user-data.yaml", |
| "tenant_id": "{{ user `os_tenant` }}", |
| "networks": ["{{ user `os_network` }}"], |
| "availability_zone": "{{user `os_zone`}}", |
| "identity_endpoint": "{{user `os_endpoint`}}", |
| "username": "{{user `os_username`}}", |
| "password": "{{user `os_password`}}" |
| }, |
| { |
| "type": "qemu", |
| "qemuargs": [ |
| [ |
| "-cpu", |
| "host" |
| ], |
| [ |
| "-m", |
| "4096M" |
| ], |
| [ |
| "-cdrom", |
| "config-drive/cloudata.iso" |
| ], |
| [ |
| "-smp", |
| "8" |
| ], |
| ["-device", "virtio-net,netdev=user.0"], |
| ["-object","rng-random,id=objrng0,filename=/dev/urandom"], |
| ["-device", "virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0x10" ] |
| ], |
| "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}.qcow2", |
| "output_directory": "images/{{ user `image_name` }}-qemu-{{ isotime \"200601021504\" }}", |
| "disk_compression": true, |
| "disk_size": "{{ user `disk_size`}}", |
| "format": "qcow2", |
| "accelerator": "kvm", |
| "iso_url": "http://cloud-images.ubuntu.com/releases/xenial/release-20180306/ubuntu-16.04-server-cloudimg-amd64-disk1.img", |
| "iso_target_path": "{{ user `images_cache`}}/release-20180306_xenial-server-cloudimg-amd64-disk1.img", |
| "iso_checksum_type": "md5", |
| "disk_image": true, |
| "iso_checksum": "566efef1d6f12e7d3a994c2405bdb642", |
| "http_directory": "http", |
| "headless": true, |
| "ssh_username": "{{user `user`}}", |
| "ssh_password": "{{user `password`}}", |
| "shutdown_command": "shutdown -P now", |
| "vnc_bind_address": "0.0.0.0", |
| "vnc_port_max": "5956", |
| "vnc_port_min": "5956", |
| "ssh_host_port_min": 7000, |
| "ssh_host_port_max": 7050, |
| "boot_wait": "2s", |
| "ssh_wait_timeout": "360s" |
| } |
| ] |
| } |