+------------------------------------------------------------------------------
| On 2015-02-25 09:59:42, Sam M via smartos-discuss wrote:
| 
| I need to run some custom scripts in the VM on creation. I know
| customer_metadata passed via the JSON on VM creation can do this, but not
| understanding how.
| 
| Does anyone have any good examples of how they are using the
| customer_metadata field for this and perhaps anything else interesting?
| Perhaps this would be of great help to others in the list too.

An especially ugly example, dropping root keys and setting the TZ in the zone
(which requires a post-creation reboot, but for an ugly example, you get the
idea.)

"customer_metadata": {
    "root_authorized_keys": "SSH KEY",
    "user-script" : "/usr/sbin/mdata-get root_authorized_keys >
    ~root/.ssh/authorized_keys ; /usr/sbin/mdata-get root_authorized_keys >
    ~admin/.ssh/authorized_keys ; while read x ; do echo ${x//UTC/US\/Eastern} ;
    done < /etc/default/init > /etc/default/init.new ; mv /etc/default/init.new
    /etc/default/init"
}

Cheers.


-------------------------------------------
smartos-discuss
Archives: https://www.listbox.com/member/archive/184463/=now
RSS Feed: https://www.listbox.com/member/archive/rss/184463/25769125-55cfbc00
Modify Your Subscription: 
https://www.listbox.com/member/?member_id=25769125&id_secret=25769125-7688e9fb
Powered by Listbox: http://www.listbox.com

Reply via email to