# User inputs to define DISK image in VM template?

**URL:** <https://forum.opennebula.io/t/user-inputs-to-define-disk-image-in-vm-template/12331>\
**Category:** Installation & Configuration\
**Created:** [August 15, 2024, 8:37am UTC](https://forum.opennebula.io/t/user-inputs-to-define-disk-image-in-vm-template/12331 "2024-08-15T08:37:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emanuel\_Torres](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/emanuel_torres/32/8180_2.png) [@Emanuel\_Torres](https://forum.opennebula.io/u/Emanuel_Torres)\
**Post date:** [August 15, 2024, 8:37am UTC](https://forum.opennebula.io/t/user-inputs-to-define-disk-image-in-vm-template/12331/1 "2024-08-15T08:37:54Z")

</div>

How can I use user inputs in an OpenNebula VM template to define the DISK image? The documentation provides an example of selecting the OS using user inputs, but I’ve tried several approaches without success. What am I missing or doing wrong?

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/opennebula/original/2X/6/6e98a22799ef57788973aa6991ba78ba66f48d87.png)

Example:

CONTEXT = [  
NETWORK = “YES”,  
SET\_HOSTNAME = “$HOSTNAME”,  
SSH\_PUBLIC\_KEY = “$USER[SSH\_PUBLIC\_KEY]” ]  
CPU = “1”  
DISK = [  
IMAGE = “$OPERATIVE\_SYSTEM”,  
IMAGE\_UNAME = “oneadmin” ]  
GRAPHICS = [  
LISTEN = “0.0.0.0”,  
TYPE = “vnc” ]  
LOGO = “images/logos/linux.png”  
LXD\_SECURITY\_PRIVILEGED = “true”  
MEMORY = “128”  
NIC\_DEFAULT = [  
MODEL = “virtio” ]  
OS = [  
ARCH = “x86\_64” ]  
USER\_INPUTS = [  
HOSTNAME = “M|text|Hostname”,  
OPERATIVE\_SYSTEM = “M|list|Operative System|ubuntu-20.04,alpine-linux-3.20” ]

---

<div class="post-metadata">

**Author:** ![vpalma](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/vpalma/32/8065_2.png) [@vpalma](https://forum.opennebula.io/u/vpalma)\
**Post date:** [August 23, 2024, 7:54am UTC](https://forum.opennebula.io/t/user-inputs-to-define-disk-image-in-vm-template/12331/2 "2024-08-23T07:54:19Z")

</div>

Hi @Emanuel_Torres 👋

Welcome to the OpenNebula forum!

The image you share only shows an example of how user entries work. Unfortunately, you cannot use user entries to select disks for the VM. **User inputs can be used to add attributes to the VM and environment variables** as well in case you add these attributes to the CONTEXT section. Here is an example:

```auto
USER_INPUTS = [
  BLOG_TITLE="M|text|Blog Title",
  MYSQL_PASSWORD="M|password|MySQL Password",
]

CONTEXT=[
  BLOG_TITLE="$BLOG_TITLE",
  MYSQL_PASSWORD="$MYSQL_PASSWORD" ]

```

In this case, OpenNebula will ask the user (using Sunstone or CLI) for the attributes defined in user inputs, subsequently filling these values in the CONTEXT section of the VM.

In case you need to provide the user with VMs with different distributions, you should create a separate VM template for each of them.

Best,  
Victor.

---

<div class="post-metadata">

**Author:** ![Emanuel\_Torres](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/emanuel_torres/32/8180_2.png) [@Emanuel\_Torres](https://forum.opennebula.io/u/Emanuel_Torres)\
**Post date:** [August 23, 2024, 7:48pm UTC](https://forum.opennebula.io/t/user-inputs-to-define-disk-image-in-vm-template/12331/3 "2024-08-23T19:48:54Z")

</div>

Thanks Much Victor!
