Merge "Add new cloud-init-datasources element"
This commit is contained in:
commit
343f70cd23
21
elements/cloud-init-datasources/README.md
Normal file
21
elements/cloud-init-datasources/README.md
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
Configures cloud-init to only use an explicit list of data sources.
|
||||||
|
|
||||||
|
Cloud-init contains a growing collection of data source modules and most
|
||||||
|
are enabled by default. This causes cloud-init to query each data source
|
||||||
|
on first boot. This can cause delays or even boot problems depending on your
|
||||||
|
environment.
|
||||||
|
|
||||||
|
You must define `DIB_CLOUD_INIT_DATASOURCES` as a comma-separated list of valid
|
||||||
|
data sources to limit the data sources that will be queried for metadata on
|
||||||
|
first boot.
|
||||||
|
|
||||||
|
For instance, to enable only the Ec2 datasource:
|
||||||
|
|
||||||
|
export `DIB_CLOUD_INIT_DATASOURCES`="Ec2"
|
||||||
|
|
||||||
|
Or to enable multiple:
|
||||||
|
|
||||||
|
export `DIB_CLOUD_INIT_DATASOURCES`="Ec2, ConfigDrive, OpenStack"
|
||||||
|
|
||||||
|
Including this element without setting `DIB_CLOUD_INIT_DATASOURCES` will cause
|
||||||
|
image builds to fail.
|
16
elements/cloud-init-datasources/install.d/05-set-cloud-init-sources
Executable file
16
elements/cloud-init-datasources/install.d/05-set-cloud-init-sources
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
DIB_CLOUD_INIT_DATASOURCES=${DIB_CLOUD_INIT_DATASOURCES:-""}
|
||||||
|
|
||||||
|
if [ -z "$DIB_CLOUD_INIT_DATASOURCES" ] ; then
|
||||||
|
echo "DIB_CLOUD_INIT_DATASOURCES must be set to a comma-separated list "
|
||||||
|
echo "of cloud-init data sources you wish to use, ie 'Ec2, NoCloud, ConfigDrive'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat > /etc/cloud/cloud.cfg.d/91-dib-cloud-init-datasources.cfg <<EOF
|
||||||
|
datasource_list: [ $DIB_CLOUD_INIT_DATASOURCES, None ]
|
||||||
|
EOF
|
1
elements/cloud-init-nocloud/element-deps
Normal file
1
elements/cloud-init-nocloud/element-deps
Normal file
@ -0,0 +1 @@
|
|||||||
|
cloud-init-datasources
|
@ -0,0 +1 @@
|
|||||||
|
export DIB_CLOUD_INIT_DATASOURCES="NoCloud"
|
@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -eu
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
cat > /etc/cloud/cloud.cfg.d/91-local-metadata-only.cfg <<EOF
|
|
||||||
# No cloud metadata available, use only what is in the image.
|
|
||||||
datasource_list: [ NoCloud, None ]
|
|
||||||
EOF
|
|
Loading…
Reference in New Issue
Block a user