# I really could use help with onetemplate instantiate if anyone has a moment

**URL:** <https://forum.opennebula.io/t/i-really-could-use-help-with-onetemplate-instantiate-if-anyone-has-a-moment/7080>\
**Category:** Product Support\
**Created:** [March 27, 2019, 10:47pm UTC](https://forum.opennebula.io/t/i-really-could-use-help-with-onetemplate-instantiate-if-anyone-has-a-moment/7080 "2019-03-27T22:47:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChristinaS](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/christinas/32/5995_2.png) [@ChristinaS](https://forum.opennebula.io/u/ChristinaS)\
**Post date:** [March 27, 2019, 10:47pm UTC](https://forum.opennebula.io/t/i-really-could-use-help-with-onetemplate-instantiate-if-anyone-has-a-moment/7080/1 "2019-03-27T22:47:15Z")

</div>

I’m working in the vOnecloud 3.2.1 environment and am having issues with instantiating from template.

I have declared 3 new ‘mandatory’ variables in the templates context:

> [oneadmin@machine root]$ onetemplate show 4  
> TEMPLATE 4 INFORMATION  
> ID : 4  
> NAME : opennebula-rhel-7.6-1902.2  
> USER : oneadmin  
> GROUP : labadmin  
> LOCK : None  
> REGISTER TIME : 03/19 15:27:32
> 
> PERMISSIONS  
> OWNER : um-  
> GROUP : u–  
> OTHER : u–
> 
> TEMPLATE CONTENTS  
> CONTEXT=[  
> DATACENTER=“$DATACENTER”,  
> DOMAIN=“$DOMAIN”,  
> INSTALL\_APP=“$INSTALL\_APP”,  
> NETWORK=“YES”,  
> SET\_HOSTNAME=“$NAME”,  
> SSH\_PUBLIC\_KEY=“$USER[SSH\_PUBLIC\_KEY]”,  
> START\_SCRIPT\_BASE64=“IyEvYmluL2Jhc2gKZWNobyAkRE-truncated”  
> CPU=“1”  
> DESCRIPTION=“Image Template with bootstrap script”  
> DISK=[  
> IMAGE\_ID=“7”,  
> OPENNEBULA\_MANAGED=“NO” ]  
> GRAPHICS=[  
> LISTEN=“0.0.0.0”,  
> TYPE=“VNC” ]  
> HYPERVISOR=“vcenter”  
> INPUTS\_ORDER=“DATACENTER,DOMAIN,INSTALL\_APP”  
> MEMORY=“2048”  
> MEMORY\_UNIT\_COST=“MB”  
> NIC=[  
> NETWORK\_ID=“0”,  
> OPENNEBULA\_MANAGED=“NO” ]  
> OS=[  
> BOOT=“” ]  
> USER\_INPUTS=[  
> DATACENTER=“O|list|Please Enter Datacenter|VCENTER1,VCENTER2,VCENTER3,VCENTER4,VCENTER5,VCENTER6,VCENTER7,VCENTER8|VCENTER1”,  
> DOMAIN=“O|list|Please Select Domain for [VM|domain1.net](http://VM%7Cdomain1.net),[domain2.com](http://domain2.com),[domain3.net](http://domain3.net),[domain4.com|domain1.net](http://domain4.com%7Cdomain1.net)”,  
> INSTALL\_APP=“O|list|Does APP need to be installed|NO,YES|NO” ]  
> VCENTER\_CCR\_REF=“domain-c137”  
> VCENTER\_INSTANCE\_ID=“7da4f44f-4092-4712-9496-beea7c4ba527”  
> VCENTER\_TEMPLATE\_REF=“vm-275”  
> VCENTER\_VM\_FOLDER=“”  
> VCPU=“1”

> onetemplate instantiate 4 --memory 1g --disk 7:size=50g --nic vDS\_LabNetwork:IP=10.26.48.79 --name TESTHOST --cpu 1 --context ‘DATACENTER=DATACENTER1,[DOMAIN=domain1.net](http://DOMAIN=domain1.net),INSTALL\_APP=NO’

No matter how I try to format the syntax around --context it doesn’t appear the variables are being inserted into the instantiation process: Continually receive the message ''There are some parameters that require user input. Use the string \<\> to launch an editor (e.g. for multi-line inputs)"

[http://docs.opennebula.org/5.8/operation/vm\_management/vm\_instances.html](http://docs.opennebula.org/5.8/operation/vm_management/vm_instances.html)

and have to select all my options and the instance instantiates fine. Is there a way around this?  
I see references to having to do an additional append from a file to the template, but can’t this be done in one step?

Thank you,  
Christina

---

<div class="post-metadata">

**Author:** ![jimmy](https://avatars.discourse-cdn.com/v4/letter/j/ee59a6/32.png) [@jimmy](https://forum.opennebula.io/u/jimmy)\
**Post date:** [March 28, 2019, 12:40pm UTC](https://forum.opennebula.io/t/i-really-could-use-help-with-onetemplate-instantiate-if-anyone-has-a-moment/7080/2 "2019-03-28T12:40:01Z")

</div>

If you want to use user input vars, you can pass them from stdin with command like:

> printf “DATACENTER1\ndomain1.net\nNO” | onetemplate instantiate 4 --memory 1g --disk 7:size=50g --nic vDS\_LabNetwork:IP=10.26.48.79 --name TESTHOST --cpu 1

But you can also drop the user input vars and only pass the values to the context as you did with the --context attr.

---

<div class="post-metadata">

**Author:** ![ChristinaS](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/christinas/32/5995_2.png) [@ChristinaS](https://forum.opennebula.io/u/ChristinaS)\
**Post date:** [March 28, 2019, 3:00pm UTC](https://forum.opennebula.io/t/i-really-could-use-help-with-onetemplate-instantiate-if-anyone-has-a-moment/7080/3 "2019-03-28T15:00:26Z")

</div>

Jimmy,

Thank you, this was exactly what I needed for now!  
After I read this, it made perfect sense.

Christina
