diff options
author | Chad Smith <chad.smith@canonical.com> | 2020-03-10 08:22:22 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-10 10:22:22 -0400 |
commit | 71af48df3514ca831c90b77dc71ba0a121dec401 (patch) | |
tree | a8fb89da80df6b119bffeb66ad162c6192f37803 /tox.ini | |
parent | 1f860e5ac7ebb5b809c72d8703a0b7cb3e84ccd0 (diff) | |
download | vyos-cloud-init-71af48df3514ca831c90b77dc71ba0a121dec401.tar.gz vyos-cloud-init-71af48df3514ca831c90b77dc71ba0a121dec401.zip |
instance-data: add cloud-init merged_cfg and sys_info keys to json (#214)
Cloud-config userdata provided as jinja templates are now distro,
platform and merged cloud config aware. The cloud-init query command
will also surface this config data.
Now users can selectively render portions of cloud-config based on:
* distro name, version, release
* python version
* merged cloud config values
* machine platform
* kernel
To support template handling of this config, add new top-level
keys to /run/cloud-init/instance-data.json.
The new 'merged_cfg' key represents merged cloud config from
/etc/cloud/cloud.cfg and /etc/cloud/cloud.cfg.d/*.
The new 'sys_info' key which captures distro and platform
info from cloudinit.util.system_info.
Cloud config userdata templates can render conditional content
based on these additional environmental checks such as the following
simple example:
```
## template: jinja
#cloud-config
runcmd:
{% if distro == 'opensuse' %}
- sh /custom-setup-sles
{% elif distro == 'centos' %}
- sh /custom-setup-centos
{% elif distro == 'debian' %}
- sh /custom-setup-debian
{% endif %}
```
To see all values: sudo cloud-init query --all
Any keys added to the standardized v1 keys are guaranteed to not
change or drop on future released of cloud-init. 'v1' keys will be retained
for backward-compatibility even if a new standardized 'v2' set of keys
are introduced
The following standardized v1 keys are added:
* distro, distro_release, distro_version, kernel_version, machine,
python_version, system_platform, variant
LP: #1865969
Diffstat (limited to 'tox.ini')
0 files changed, 0 insertions, 0 deletions