cloud-init and ssh Keys in Openstack

asked 2016-10-11 10:23:13 -0500

hkominos gravatar image

updated 2016-10-11 10:24:06 -0500

Hi All.

I have a small deployment and I am using cloud-init to configure the vms. I am using the cloud images from ubuntu. Those images have a standard user (ubuntu) which is used to log in to the instance with the key pair. I dont want to use the ubuntu user but I want to have two users (one admin on user) and those users use ssh to login. In the cloud init I specify the users. The simple user has it public key in the script and I can log in with him. I want however the admin key to be given by the openstack UI to the first user (users[0] not named ubuntu). However I cannot make it work.

Can anybody help?

#cloud-config

groups:
  - ControlVM
  - CPGroup

users:
  - name: master
    gecos: master
    shell: /bin/bash
    primary-group: ControlVM
    sudo: ALL=(ALL) NOPASSWD:ALL
  - name: client
    gecos: MoreInfoOfClient
    shell: /bin/bash
    primary-group: CPGroup    
    ssh_authorized_keys:
      - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCiDM6Gp++ypsLk95uvVjyXMiRN+OawhZCI8Hhmk255GvFJIUijU7R7Ac5cKwH1EwW4A6Mpce1+DZkIYY4OmCc2zKvaW/ua4jqk9hbKhosVpgGTCGHSkOnsW6IjFbc3BEeLcFx6PqavPdtRBm1qwZ9f8kkIjZ3dICgXjDOPaYBDCga2EDO44mDcNzHDpj91UXo3V/a53nEucRcGyvEGBvaPIXpIrrDX1lK5BaDWO7rGaOPRPlAXcmZaXCbl/rQCuyTrqVjNZV4BiWxyQNN81LEt1iFNore0jZKE35/N89RL9kvQAuB7bMPizYAcK6b182OKnhTmHMVDvxAdq3xSXTL4A9zOo9vUvMouGg0 user@user.com


final_message: "The system is finally up, after $UPTIME seconds with no errors"
edit retag flag offensive close merge delete