---

# build trigger: 201907171352

variables:
  ssh_auth_keys: "{{ env `PACKER_SSH_AUTH_KEYS` }}"
  esx_host: "{{ env `PACKER_ESX_HOST` }}"
  esx_datastore: "{{ env `PACKER_ESX_DATASTORE` }}"
  esx_username: "{{ env `PACKER_ESX_USERNAME` }}"
  esx_password: "{{ env `PACKER_ESX_PASSWORD` }}"

builders:
  - type: vmware-iso
    vm_name: ubicast-base
    display_name: ubicast-base
    output_directory: output
    guest_os_type: debian10-64
    iso_urls:
      - http://debian.univ-lorraine.fr/debian-cd/current/amd64/iso-cd/debian-10.1.0-amd64-netinst.iso
      - https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.1.0-amd64-netinst.iso
    iso_checksum: 23237b0a100a860b3dc7ffcfb5baae4bed5460ac5f3f2b929df3154f3319b9809055b695264586f60289cc6cb25077c12938cc612fee01756bfa779c87d5a315
    iso_checksum_type: sha512
    remote_type: esx5
    remote_host: "{{ user `esx_host` }}"
    remote_datastore: "{{ user `esx_datastore` }}"
    remote_username: "{{ user `esx_username` }}"
    remote_password: "{{ user `esx_password` }}"
    format: ova
    tools_upload_flavor: linux
    vnc_disable_password: true
    cpus: 2
    memory: 2048
    vmx_data:
      ethernet0.networkName: VM Network
    boot_command:
      - "<esc><wait>"
      - "/install.amd/vmlinuz "
      - "initrd=/install.amd/initrd.gz "
      - "hostname={{ .Name }} "
      - "domain= "
      - "auto=true "
      - "url=https://www.ubicast.eu/media/downloads/sys/preseed.cfg "
      - "vga=788 noprompt quiet --<enter>"
    ssh_username: root
    ssh_password: ubicast
    ssh_timeout: 15m
    headless: false
    shutdown_command: shutdown -P now

provisioners:
  - type: file
    source: packer/files/root.cfg
    destination: /tmp/99_root.cfg
  - type: shell
    expect_disconnect: true
    pause_before: 10s
    environment_vars:
      - PACKER_SSH_AUTH_KEYS={{ user `ssh_auth_keys` }}
    scripts:
      - packer/scripts/root.sh
      - packer/scripts/upgrade.sh
      - packer/scripts/upgrade-buster.sh
      - packer/scripts/reboot.sh
  - type: shell
    pause_before: 30s
    scripts:
      - packer/scripts/cleanup-buster.sh

...
