Skip to content

Make host information available in templates #4560

@prskr

Description

@prskr

Description

Hi all,

thanks for this awesome tool!

To give a little bit of context first: I'm using lima to provision CI agents on my MacStudio and my Linux desktop.
I'm using the same template for both machines, because the CI agent should have the same capabilities for both systems, the main difference is that the Mac runs on a ARM64 architecture and the Linux on desktop x86_64 architecture.

I saw, that there is already an issue ( #3993 ) that goes into a similar direction, that it would be great to be able to query certain driver/host facts in a template, to be able to switch certain behavior.

I propose to go one step further and not only expose certain driver features but also

  • OS
  • architecture
  • CPU core count
  • Total memory in MB
  • hostname
  • ???

via something like {{ .host.<fact> }}

This would make it a lot easier to dynamically adapt the template to the host.

The challenges I'm currently facing are:

  • on Linux I need to fallback to legacy BIOS
  • scripts to install software have to check for the host CPU architecture and incorporate the current architecture in the URL
  • depending on the host, I've to reduce the size (CPU cores and memory) of the VM
  • probably I'm forgetting something 😅

If that is something you would consider I'd be happy to also create a PR for it of course :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions