| 1 | #cloud-config |
| 2 | |
| 3 | hostname: {name} |
| 4 | |
| 5 | # add host to the /etc/hosts |
| 6 | manage_etc_hosts: true |
| 7 | |
| 8 | # don't disable the root user |
| 9 | disable_root: false |
| 10 | |
| 11 | users: |
| 12 | # create the user for me |
| 13 | - name: myuser |
| 14 | # I like to sudo! |
| 15 | groups: sudo |
| 16 | sudo: ALL=(ALL) NOPASSWD:ALL |
| 17 | lock_passwd: false |
| 18 | # set user password. Can be generated with mkpasswd (in whois package) |
| 19 | # mkpasswd --method=SHA-512 |
| 20 | passwd: $6$pwewv |
| 21 | ssh_authorized_keys: |
| 22 | - ssh-rsa MY_SSH_KEY_GOES_HERE... |
| 23 | shell: /bin/bash |
| 24 | # update SSH key for root (probably not a best practice to allow this but...) |
| 25 | - name: root |
| 26 | ssh_authorized_keys: |
| 27 | - ssh-rsa MY_SSH_KEY_GOES_HERE... |
| 28 | |
| 29 | # Update APT repo and upgrade packages |
| 30 | package_update: true |
| 31 | package_upgrade: true |
| 32 | |
| 33 | # Install a few packages |
| 34 | packages: |
| 35 | - htop |
| 36 | - nano |
| 37 | |
| 38 | locale: en_US.UTF-8 |
| 39 | timezone: America/Edmonton |
| 40 | runcmd: |
| 41 | # Download and install XE Guest Utils from Github Repo |
| 42 | - curl -sL https://github.com/xenserver/xe-guest-utilities/releases/download/v8.4.0/xe-guest-utilities_8.4.0-1_amd64.deb -o /tmp/xe-guest-utilities.deb && sudo dpkg -i /tmp/xe-guest-utilities.deb |
| 43 | |
| 44 | # Disable password-based authentication for SSH |
| 45 | ssh_pwauth: False |
jeff / CloudConfig Example
Last active 6 months ago
Sample CloudConfig for my XCP-ng Ubuntu-images.
Revision a3c648b185fda6370cdfee95fe104c6c2e0c342a