Managing your cloud resources with OpenStack/en: Difference between revisions

Jump to navigation Jump to search
Importing a new version from external source
(Importing a new version from external source)
(Importing a new version from external source)
Line 108: Line 108:
Alternatively, you can do this during the creation of a VM using [http://cloudinit.readthedocs.org/en/latest/index.html# CloudInit]. The following CloudInit script adds two users <code>gretzky</code> and <code>lemieux</code> with and without sudo permissions respectively.
Alternatively, you can do this during the creation of a VM using [http://cloudinit.readthedocs.org/en/latest/index.html# CloudInit]. The following CloudInit script adds two users <code>gretzky</code> and <code>lemieux</code> with and without sudo permissions respectively.


  #cloud-config
#cloud-config
  users:
  users:
   - name: gretzky
   - name: sysadmin
     shell: /bin/bash
     shell: /bin/bash
     sudo: ALL=(ALL) NOPASSWD:ALL
     sudo: ALL=(ALL) NOPASSWD:ALL
     ssh_authorized_keys:
     ssh_authorized_keys:
       - <Gretzky's public key goes here>
       - <Insert public key>
   - name: lemieux
   - name: user
     shell: /bin/bash
     shell: /bin/bash
     ssh_authorized_keys:
     ssh_authorized_keys:
       - <Lemieux's public key goes here>
       - <Insert public key>


adds two users <code>sysadmin</code> and <code>user</code> with and without sudo permissions respectively. The <code><Insert public key></code> must be replaced with the public key to use for that user. Note that YAML is very picky about white space formatting, so that there must be a space after the "-" before your public key string. Also, this configuration overwrites the default user that is added when no CloudInit script is specified, so that the users listed in this configuration script will be the only users on the newly created VM so it is important to have at least one user with sudo permission. More users can be added by simply including another <code>- name: username</code> section.
adds two users <code>sysadmin</code> and <code>user</code> with and without sudo permissions respectively. The <code><Insert public key></code> must be replaced with the public key to use for that user. Note that YAML is very picky about white space formatting, so that there must be a space after the "-" before your public key string. Also, this configuration overwrites the default user that is added when no CloudInit script is specified, so that the users listed in this configuration script will be the only users on the newly created VM so it is important to have at least one user with sudo permission. More users can be added by simply including another <code>- name: username</code> section.
1,221

edits

Navigation menu