brietmax
Contributor
Contributor

Add user to Ubuntu blueprint

Hello 

I have an Ubuntu blueprint With vmware tools install all thé customisation IS ok but i tries to add a custom propertie to enter a user n'aime and password and add thème to a New user on thé déployed serveur With no success

Can you help me

 

 

 

 

0 Kudos
8 Replies
bdamian
Expert
Expert

Are you using and Ubuntu template with Cloud-Init?

Damián Bacalov
vExpert 2017-2018-2019-2020-2021
https://www.linkedin.com/in/damianbacalov/
twitter @bdamian
Tags (1)
0 Kudos
brietmax
Contributor
Contributor

I use Ubuntu template With the vmware tools and all the network config and os config IS throught vmware tools and vsphere customisation file

0 Kudos
bdamian
Expert
Expert

I should say that is possible to add a new user to an ubuntu server through VMware Tools in post provision. But let me tell you, with Cloud-Init this is by far more simple.

With cloud-init you just need to add a couple of lines in the Cloud Template.

With only vmware tools, you need a subscription to vRealize Orchestrator workflow, use an Action with PowerShell and you also need vCenter Credentials + Ubuntu credentials to execute the commands.

Damián Bacalov
vExpert 2017-2018-2019-2020-2021
https://www.linkedin.com/in/damianbacalov/
twitter @bdamian
brietmax
Contributor
Contributor

 
0 Kudos
brietmax
Contributor
Contributor

I will install it and try With i will search how to do 

0 Kudos
bdamian
Expert
Expert

This is my Template which adds a user to an Ubuntu server:

formatVersion: 1
inputs:
  username:
    type: string
    title: Username
    description: Default user
  password:
    type: string
    title: Password
    description: Ingrese una contraseña
    writeOnly: true
resources:
  Cloud_Machine_1:
    type: Cloud.Machine
    properties:
      image: Ubuntu 20.04 Cloud
      flavor: small
      constraints:
        - tag: 'env:dev'
      cloudConfig: |
        #cloud-config
        hostname: ubuntu-dev
        ssh_pwauth: yes
        groups:
          - ${input.username}
        users:
          - default 
          - name: ${input.username}
            primary-group: ${input.username}
            groups: [sudo]
            lock_passwd: false
            sudo: ['ALL=(ALL) NOPASSWD:ALL']
            shell: '/bin/bash'
        chpasswd:
          list: |
            ${input.username}:${input.password}
          expire: false
        runcmd:
          - echo "Defaults:${input.username} !requiretty" >> /etc/sudoers.d/${input.username}
Damián Bacalov
vExpert 2017-2018-2019-2020-2021
https://www.linkedin.com/in/damianbacalov/
twitter @bdamian
Tags (1)
0 Kudos
brietmax
Contributor
Contributor

Hello

I think i have an issue but i don't understand where

My deployment IS ok but on the VM console i have an error no finger print find for the user vra

IS my local user so thé cloud config not apply

0 Kudos
bdamian
Expert
Expert

I understand, my advice is: make a lab with an Ubuntu Cloud Image. Download the OVA file and put it in a Content Library, then use this image in the Image Mapping.

Create the template and remember to use Dynamic IP. Test it, if it works, we can go forward.

Damián Bacalov
vExpert 2017-2018-2019-2020-2021
https://www.linkedin.com/in/damianbacalov/
twitter @bdamian
0 Kudos