hoangweb
4/16/2016 - 1:23 PM

vps- cloud config

vps- cloud config

#cloud-config
users:
  - name: demo       # a single list item, indicates that we are only defining a single user.
    groups: sudo
    primary-group: demo
    passwd: <hashed password>
    shell: /bin/bash

    # define sudo privileges
    sudo: ['ALL=(ALL) NOPASSWD:ALL']

    # list of complete SSH public keys
    ssh-authorized-keys:
      - ssh-rsa AAAAB3NzaC1yc2EAA...
      - ssh-rsa AAAAB3NzaC1yc2EAAAAD...

    gecos: info about user

    # account should expire
    expiredate: YYYY-MM-DD

    # set the account to inactive.
    inactive: True

    # mark system account with no home directory.
    system: True

    # override the default /home/<username>, which is otherwise created and set.
    homedir: /public/user1

    # avoid creating a /home/<username> directory for the user.
    no-create-home: True

    # avoid creating a group with the same name as the user.
    no-user-group: True

  - name: user1     # Each new user should begin with a dash.

# define groups
groups:
  - group1
  - group2: [user1, user2]

# Change Passwords for Existing Users
chpasswd:
  list: |
    user1:password1
    user2:password2
    user3:password3

  # whether the password must be changed at first boot or not.
  expire: False

# Write Files to the Disk
write_files:
  - path: /test.txt
    content: |
      Here is a line.
      Another line is here.
    owner: user1