---
# Ironic Python Agent (IPA) configuration.

###############################################################################
# Ironic Python Agent (IPA) image build configuration.

# Whether to build IPA images from source.
ipa_build_images: False

# URL of IPA source repository.
ipa_build_source_url: "https://opendev.org/openstack/ironic-python-agent"

# Version of IPA source repository. Default is {{ openstack_branch }}.
ipa_build_source_version: "{{ openstack_branch }}"

# URL of IPA builder source repository.
ipa_builder_source_url: "https://opendev.org/openstack/ironic-python-agent-builder"

# Version of IPA builder source repository. Default is {{ openstack_branch }}.
ipa_builder_source_version: "{{ openstack_branch }}"

# List of additional build host packages to install.
ipa_build_dib_host_packages_extra: []

# List of default Diskimage Builder (DIB) elements to use when building IPA
# images. Default is ["centos", "enable-serial-console",
# "ironic-python-agent-ramdisk"] when os_distribution is "rocky", and
# ["ubuntu", "enable-serial-console", "ironic-python-agent-ramdisk"] otherwise.
ipa_build_dib_elements_default:
  # TODO(mattcrees): Use {{ os_distribution }} here when Rocky IPA builds work.
  - "{{ 'centos' if os_distribution == 'rocky' else os_distribution }}"
  - enable-serial-console
  - ironic-python-agent-ramdisk

# List of additional Diskimage Builder (DIB) elements to use when building IPA
# images. Default is none.
ipa_build_dib_elements_extra: []

# List of Diskimage Builder (DIB) elements to use when building IPA images.
# Default is combination of ipa_build_dib_elements_default and
# ipa_build_dib_elements_extra.
ipa_build_dib_elements: >
  {{ ipa_build_dib_elements_default +
     ipa_build_dib_elements_extra }}

# Dictionary of default environment variables to provide to Diskimage Builder
# (DIB) during IPA image build.
ipa_build_dib_env_default:
  # TODO(mattcrees): Use {{ os_release }} here when Rocky IPA builds work.
  DIB_RELEASE: "{{ '9-stream' if os_distribution == 'rocky' else os_release }}"
  DIB_REPOLOCATION_ironic_python_agent: "{{ ipa_build_source_url }}"
  DIB_REPOREF_ironic_python_agent: "{{ ipa_build_source_version }}"
  DIB_REPOREF_requirements: "{{ ipa_build_source_version }}"

# Dictionary of additional environment variables to provide to Diskimage
# Builder (DIB) during IPA image build.
ipa_build_dib_env_extra: {}

# Dictionary of environment variables to provide to Diskimage Builder (DIB)
# during IPA image build.
ipa_build_dib_env: >
  {{ ipa_build_dib_env_default |
     combine(ipa_build_dib_env_extra) }}

# List of default git repositories containing Diskimage Builder (DIB) elements.
# See stackhpc.openstack.os_images role for usage.
# Default is one item for IPA builder.
ipa_build_dib_git_elements_default:
  - repo: "{{ ipa_builder_source_url }}"
    local: "{{ source_checkout_path }}/ironic-python-agent-builder"
    version: "{{ ipa_builder_source_version }}"
    elements_path: "dib"

# List of additional git repositories containing Diskimage Builder (DIB)
# elements. See stackhpc.openstack.os_images role for usage. Default is empty.
ipa_build_dib_git_elements_extra: []

# List of git repositories containing Diskimage Builder (DIB) elements. See
# stackhpc.openstack.os_images role for usage. Default is a combination of
# ipa_build_dib_git_elements_default and ipa_build_dib_git_elements_extra.
ipa_build_dib_git_elements: >-
  {{ ipa_build_dib_git_elements_default + ipa_build_dib_git_elements_extra }}

# List of DIB packages to install. Default is none.
ipa_build_dib_packages: []

# Upper constraints file for installing packages in the virtual environment
# used for building IPA images. Default is {{ pip_upper_constraints_file }}.
ipa_build_upper_constraints_file: "{{ pip_upper_constraints_file }}"

# Upper constraints file for installation of DIB to build IPA images.
# Default is empty string.
ipa_build_dib_upper_constraints_file: ""

###############################################################################
# Ironic Python Agent (IPA) images configuration.

# Suffix of upstream Ironic deployment image files. Default is based on
# {{ openstack_branch }}.
ipa_images_upstream_url_suffix: "-{{ openstack_branch | replace('/', '-') }}"

# Name of Ironic deployment kernel image to register in Glance.
ipa_images_kernel_name: "ipa.kernel"

# URL of Ironic deployment kernel image to download.
ipa_kernel_upstream_url: "https://tarballs.openstack.org/ironic-python-agent/dib/files/ipa-centos9{{ ipa_images_upstream_url_suffix }}.kernel"

# URL of checksum of Ironic deployment kernel image.
ipa_kernel_checksum_url: "{{ ipa_kernel_upstream_url }}.{{ ipa_kernel_checksum_algorithm }}"

# Algorithm of checksum of Ironic deployment kernel image.
ipa_kernel_checksum_algorithm: "sha256"

# Name of Ironic deployment ramdisk image to register in Glance.
ipa_images_ramdisk_name: "ipa.initramfs"

# URL of Ironic deployment ramdisk image to download.
ipa_ramdisk_upstream_url: "https://tarballs.openstack.org/ironic-python-agent/dib/files/ipa-centos9{{ ipa_images_upstream_url_suffix }}.initramfs"

# URL of checksum of Ironic deployment ramdisk image.
ipa_ramdisk_checksum_url: "{{ ipa_ramdisk_upstream_url }}.{{ ipa_ramdisk_checksum_algorithm }}"

# Algorithm of checksum of Ironic deployment ramdisk image.
ipa_ramdisk_checksum_algorithm: "sha256"

###############################################################################
# Ironic Python Agent (IPA) deployment configuration.

# Whether to enable collection of LLDP TLVs.
ipa_collect_lldp: True

# List of default inspection collectors to run.
# NOTE: extra-hardware is not currently included as it requires a ramdisk
#       with the hardware python module installed.
ipa_collectors_default:
  - "default"
  - "logs"
  - "pci-devices"

# List of additional inspection collectors to run.
ipa_collectors_extra: []

# List of inspection collectors to run.
ipa_collectors: >
  {{ ipa_collectors_default +
     ipa_collectors_extra }}

# List of default inspection benchmarks to run.
ipa_benchmarks_default:
  - "cpu"
  - "disk"
  - "mem"

# List of extra inspection benchmarks to run.
ipa_benchmarks_extra: []

# List of inspection benchmarks to run.
ipa_benchmarks: >
  {{ (ipa_benchmarks_default +
      ipa_benchmarks_extra)
     if 'extra-hardware' in ipa_collectors else [] }}

# List of default kernel parameters for Ironic python agent.
ipa_kernel_options_default: >
  {{ ['ipa-collect-lldp=' ~ '1' if ipa_collect_lldp else '0'] +
     ['ipa-inspection-collectors=' ~ ipa_collectors | join(',')] +
     ['ipa-inspection-benchmarks=' ~ ipa_benchmarks | join(',')] }}

# List of additional kernel parameters for Ironic python agent.
ipa_kernel_options_extra: []

# List of kernel parameters for Ironic python agent.
ipa_kernel_options: >
  {{ ipa_kernel_options_default +
     ipa_kernel_options_extra }}
