{# device_type: x86 #}
{% extends 'base.jinja2' %}

# in milliseconds
{% set boot_character_delay = boot_character_delay | default(500) %}
{% set boot_interface = boot_interface | default('net0') %}
{% block body %}

{% set console_device = console_device | default('ttyS0') %}
{% set baud_rate = baud_rate | default(115200) %}

{# allow job context override - use a different variable name, undefined if not in job context #}
{% set base_kernel_args = extra_kernel_args | default(base_kernel_args) %}

actions:
  deploy:
    methods:
      tftp:
      nbd:
      ssh:
        options:
{{ ssh_options }}
        host: '{{ ssh_host|default('') }}'
        user: {{ ssh_user|default('root') }}
        port: {{ ssh_port|default(22) }}
        identity_file: {{ ssh_identity_file }}
  boot:
    connections:
      serial:
    methods:
      ssh:
      ipxe:
        parameters:
          bootloader_prompt: {{ bootloader_prompt|default('iPXE>') }}
          use_bootscript: {{ use_bootscript|default(False)}}
          lava_mac: {{ lava_mac_address|default('00:90:05:af:00:7d') }}
        nfs:
          commands:
          - dhcp {{ boot_interface }}
          - set console console={{ console_device }},{{ baud_rate }}n8 lava_mac={LAVA_MAC}
          - "set extraargs root=/dev/nfs rw {{ base_nfsroot_args }} {{ base_kernel_args }} {{ base_ip_args }}"
          - kernel tftp://{SERVER_IP}/{KERNEL} ${extraargs} ${console}
          - initrd tftp://{SERVER_IP}/{RAMDISK}
          - boot
        nbd:
          commands:
          - dhcp {{ boot_interface }}
          - set console console={{ console_device }},{{ baud_rate }}n8 lava_mac={LAVA_MAC}
          - set extraargs {{ base_nbdroot_args }} rw {{ base_kernel_args }} {{ base_ip_args }}
          - kernel tftp://{SERVER_IP}/{KERNEL} ${extraargs} ${console}
          - initrd tftp://{SERVER_IP}/{RAMDISK}
          - boot
        ramdisk:
          commands:
          - dhcp {{ boot_interface }}
          - set console console={{ console_device }},{{ baud_rate }}n8 lava_mac={LAVA_MAC}
          - set extraargs {{ base_kernel_args }} {{ base_ip_args }}
          - kernel tftp://{SERVER_IP}/{KERNEL} ${extraargs} ${console}
          - initrd tftp://{SERVER_IP}/{RAMDISK}
          - boot
{% endblock body %}

{% block timeouts %}
timeouts:
  actions:
    bootloader-retry:
      minutes: 2
    bootloader-interrupt:
      minutes: 5
    bootloader-commands:
      minutes: 5
  connections:
    bootloader-retry:
      minutes: 2
    bootloader-interrupt:
      minutes: 5
    bootloader-commands:
      minutes: 5
{% endblock timeouts %}
