Using model-config key: cloudinit-userdata


#1

Introduction

Note: This is a sharp knife feature - be careful with it.

Cloudinit-userdata

Allows the user to provide additional cloudinit data to be included in the cloudinit data created by juju. In general, specifying a key will overwrite what juju puts in the cloudinit file with the following caveats:

  1. Users and bootcmd keys will cause an error
  2. The packages key will be appended to the packages listed by juju
  3. The runcmds key will cause an error. You can specify preruncmd and postruncmd keys to prepend and append the runcmd created by juju
    Included in juju 2.3.1.

Using

Create a file, cloudinit-userdata.yaml, which starts with the cloudinit-userdata key and data you wish to include in the cloudinit file. Note: juju reads the value as a string, though formatted as yaml.

juju model-config cloudinit-userdata.yaml
juju model-config cloudinit-userdata --format yaml

sample yaml:

cloudinit-userdata: |
  packages:
    - 'python-keystoneclient'
    - 'python-glanceclient'

Known Issues

Runcmd accepts both lists of strings and strings. Only strings strings are handled until “cloudinit-userdata doesn’t handle lists in rancid properly” is fixed.


The Juju Show #44 - 6PM UTC - Getting and using Juju 2.5
#2

@pmatulis One of the field engineers noted that cloudinit-userdata was lacking in documentation examples today.

His particular case was passing in YAML to the key/value style usage in the CLI, which he could not do successfully.


#3

why don’t we file that as a docs issue @manadart please? https://github.com/juju/docs/issues/new


#4

I’ve done so: https://github.com/juju/docs/issues/3354