<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div><span>Regarding the hostname script that's exactly what I did, I also tried to redeploy this persistent image. Where exactly did you set the HOSTNAME variable? I have setted it in the tags of that specific VM (where I would also add the SSH_PUBLIC_KEY variable). But that might be wrong?</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span>Regards,</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
 HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><span>ML<br></span></div><div style="display: block;" class="yahoo_quoted"> <br> <br> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> On Thursday, February 27, 2014 2:47 AM, "Campbell, Bill" <bcampbell@axcess-financial.com> wrote:<br> </font> </div>  <div class="y_msg_container"><div id="yiv9012983388"><div><div style="font-family:trebuchet ms, sans-serif;font-size:10pt;color:#000000;"><div>For item 1, no that should do it, just make sure it's executable and it should run. (the vmcontext init.d script will run all scripts in the /etc/one-context.d directory in order).  I set this up for
 Ubuntu, but I'm pretty sure Debian is the same when it comes to setting the hostname.  You mention you reboot the VM, you may have to redeploy (as the context script is already generated from your previous deployment package).</div><div><br clear="none"></div><div>For item 2, you could include it in your base image, or in the example provided, add it to the files repository along with that init.sh script, and then assign both files to the template.  This way the files will be included with the context information, will copy the ##-script over to the instance, and restart the vmcontext service.</div><div><br clear="none"></div><hr id="yiv9012983388zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica, Arial, sans-serif;font-size:12pt;"><b>From: </b>"ML mail" <mlnospam@yahoo.com><br clear="none"><b>To: </b>"users" <users@lists.opennebula.org><br clear="none"><b>Sent:
 </b>Wednesday, February 26, 2014 11:12:08 AM<br clear="none"><b>Subject: </b>Re: [one-users] ONE context package<br clear="none"><div><br clear="none"></div><div class="yiv9012983388yqt1583315398" id="yiv9012983388yqt04119"><div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;"><div><span>Hi Bill,</span></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><br clear="none"><span></span></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><span>Thanks for your answer and example scripts. I have a few more questions or issues regarding your examples:</span></div><div style="color:rgb(0, 0,
 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><br clear="none"><span></span></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><span>- I tried out your small hostname script which I have copied on my Debian 7 VM under /etc/one-context.d/98-hostname. I have then set in my VM a tag called HOSTNAME with a value and rebooted the VM. Unfortunately the hostname did not get changed. Did I miss something here?</span></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><span><br clear="none"></span></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica
 Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><span>- I suppose I would have to re-create the one-context package manually if I would like to include the aforementioned 98-hostname
 script in the official one-context package, correct? or I could manually copy it into my image before deploying it?</span></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><br clear="none"><span></span></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><span>Regards,</span></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><span>ML<br clear="none"></span></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><br
 clear="none"><span></span></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><span></span></div><div class="yiv9012983388yahoo_quoted" style="display:block;"> <br clear="none"> <br clear="none"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;"> <div dir="ltr"> <span style="font-family:Arial;font-size:small;"> On Wednesday, February 26, 2014 3:08 PM, "Campbell, Bill" <bcampbell@axcess-financial.com> wrote:<br clear="none"> </span> </div>  <div class="yiv9012983388y_msg_container"><div id="yiv9012983388"><div><div style="font-family:trebuchet ms, sans-serif;font-size:10pt;color:#000000;"><div>We don't have the automatic lookup from
 DNS (that would rely on the DNS record being created first prior to VM
 deployment), but we use a script that is placed in our base images /etc/one-context.d/ directory that does this (which relies on option 2 as you mention below, a HOSTNAME context variable):<br clear="none"></div><div><br clear="none"></div><div><div style="margin:0px;"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">#!/bin/bash</span></div><div style="margin:0px;"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"><br clear="none"></span></div><div style="margin:0px;"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">if [ -f /mnt/context.sh ]; then</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> . /mnt/context.sh</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">else</span><br clear="none"><span style="font-family:'courier new', courier, monaco,
 monospace, sans-serif;"> exit 0</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">fi</span></div><div style="margin:0px;"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">hostname $HOSTNAME</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">echo $HOSTNAME > /etc/hostname</span></div><div style="margin:0px;"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"><br clear="none"></span></div><div style="margin:0px;"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">exit 0</span></div></div><div><br clear="none"></div><div>The above example is for our Ubuntu instances, so it may need to be modified for RHEL or SUSE based virtuals, if that's what you use.</div><div><br clear="none"></div><div>In addition, if using 4.4, use the files datastore and create an
 'init.sh' script that can then load up additional files that you assign to the template (so you don't need to manually update each image).  We use an init.sh script like this to inject new configuration/contextualization options so we don't need to update our base image very often:<br clear="none"></div><div><br clear="none"></div><div><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"></span></span><div style="margin:0px;"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">#!/bin/sh</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">#</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"># OpenNebula Init Script</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace,
 sans-serif;">#</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"># init.sh</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">#</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"># Copies additional context scripts to the appropriate directory</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">#</span></div><div style="margin:0px;"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">## Set environment</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">SOURCE=/mnt</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">DEST=/etc/one-context.d</span></div><div style="margin:0px;"><br clear="none"></div><div
 style="margin:0px;"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">if [ -f /etc/redhat-release ]; then</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> OSVERSION=RHEL</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">else</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> OSVERSION=UBUNTU</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">fi</span></div><div style="margin:0px;"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">if [ -f /usr/bin/rsync ]; then</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> echo "Applying additional contextualization scripts..."</span><br clear="none"><span style="font-family:'courier new',
 courier, monaco, monospace, sans-serif;">else</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> if [ "$OSVERSION" != "UBUNTU" ]; then</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> yum -y install rsync</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> else</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> apt-get update && apt-get -y install rsync</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> fi</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">fi</span></div><div style="margin:0px;"><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">## Copy Files. This will IGNORE any
 *.sh files in the source/destination directories, as all context scripts</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">## should NOT have the .sh extension.</span></div><div style="margin:0px;"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">for i in $(ls $SOURCE --ignore=*.sh)</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">do</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> if [ -f $DEST/$i ]; then</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> echo "$i exists in context directory. Skipping..."</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> else</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace,
 sans-serif;"> rsync -au $SOURCE/$i /etc/one-context.d/</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> chown root.root /etc/one-context.d/*</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> chmod 700 /etc/one-context.d/*</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> service vmcontext restart</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;"> fi</span><br clear="none"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">done</span></div><div style="margin:0px;"><span style="font-family:'courier new', courier, monaco, monospace, sans-serif;">exit 0</span></div><br clear="none"></div><div>This will check the OS Version and install the appropriate package.  It will NOT copy any file that has the .sh
 extension, but if you follow the context script standard of ##-<scriptname> then you can add additional context upon deployment.  Rudimentary, sure, but works well enough for us.</div><div><br clear="none"></div><div><br clear="none"></div><hr id="yiv9012983388zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica, Arial, sans-serif;font-size:12pt;"><b>From: </b>"ML mail" <mlnospam@yahoo.com><br clear="none"><b>To: </b>users@lists.opennebula.org<br clear="none"><b>Sent: </b>Wednesday, February 26, 2014 5:39:46 AM<br clear="none"><b>Subject: </b>[one-users] ONE context package<br clear="none"><div><br clear="none"></div><div class="yiv9012983388yqt0328767977" id="yiv9012983388yqt67561"><div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;"><div>Hi,</div><div><br clear="none"></div><div
 style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">I am very happy with the ONE context package for automated contextualization on Debian and CentOS but I miss one feature: automatically and manually setting the hostname of the VM.</div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><br clear="none"></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">Basically it would be
 great to have the following two options:</div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><br clear="none"></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">- automatically set the hostname of the VM based doing a reverse DNS lookup on the IP address, for example I have as reverse DNS entry "one-vm-1-0-16-172.mydomain.com" then the hostname of my VM would be automatically set to "one-vm-1-0-16-172". <br clear="none"></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">- using a HOSTNAME tag in the VM to manually enter a hostname and overriding the
 automatic
 hostname attribution described above</div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><br clear="none"></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">What do you think?</div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;"><br clear="none"></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">Regards,</div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida
 Grande, sans-serif;background-color:transparent;font-style:normal;">ML</div></div></div><br clear="none">_______________________________________________<br clear="none">Users mailing list<br clear="none">Users@lists.opennebula.org<br clear="none">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org<br clear="none"></div><div><br clear="none"></div></div>
<br clear="none"></div><div><b>NOTICE: Protect the information in this message in accordance with the company's security policies. If you received this message in error, immediately notify the sender and destroy all copies.</b></div><div><br clear="none"></div></div><br clear="none"><div class="yiv9012983388yqt0328767977" id="yiv9012983388yqt42353">_______________________________________________<br clear="none">Users mailing list<br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:Users@lists.opennebula.org" target="_blank" href="mailto:Users@lists.opennebula.org">Users@lists.opennebula.org</a><br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br clear="none"></div><br clear="none"><div><br clear="none"></div></div>  </div> </div>  </div> </div></div><br
 clear="none">_______________________________________________<br clear="none">Users mailing list<br clear="none">Users@lists.opennebula.org<br clear="none">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org<br clear="none"></div><div><br clear="none"></div></div>
<br clear="none"></div><div><b>NOTICE: Protect the information in this message in accordance with the company's security policies. If you received this message in error, immediately notify the sender and destroy all copies.</b></div><div><br clear="none"></div></div><br><div class="yqt1583315398" id="yqt26055">_______________________________________________<br clear="none">Users mailing list<br clear="none"><a shape="rect" ymailto="mailto:Users@lists.opennebula.org" href="mailto:Users@lists.opennebula.org">Users@lists.opennebula.org</a><br clear="none"><a shape="rect" href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br clear="none"></div><br><br></div>  </div> </div>  </div> </div></body></html>