- Community Home
- >
- Software
- >
- HPE Morpheus Software
- >
- HPE Morpheus Enterprise
- >
- Custom Users in User Data
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2025 06:09 AM
02-19-2025 06:09 AM
Custom Users in User Data
Hello,
I recently had a request for help completely overriding the users list within the Cloud Init User Data of a virtual machine deployment. Please note this is an edge case requirement. Morpheus automatically configures users within Cloud Init for you, and you should not need to use this approach. It serves as an example for custom Cloud Init User Data only. You should be able to achieve what you need with Users and User Groups in Morpheus.
I will briefly document how you can achieve this below. This assumes prior knowledge of Morpheus Variables, Option Type Inputs and the customOptions variable, Cloud Init User Data and also Morpheus library items.
This example will allow someone to dynamically change the name of the custom user in the User Data during deployment. This can be extended further to support additional users, password configuration and Cypher secrets.
Add the custom user data to the Virtual Image settings for the library item. This could also be set on the Cloud level settings:
Here is the redacted example user data:
users:
- name: <%= customOptions?.name ?: 'taylor' %>
lock-passwd: false
shell: /bin/bash
passwd: <redacted>
sudo: ALL=(ALL) ALL
This will fallback to setting the name to taylor if the customOption is not specified.
Create a text option type input with name as the field name:
Add this to the library item configuration, in this example, I add it to the layout:
Now when I deploy the instance using this layout I am presented with a text box to specify a name. The input I specify will be used for the name of the user in the users list.
Thanks,
Chris