Build cloud-init.yamls from multiple files
-
create a cloud-init.tmpl.yaml containing
#include: <relative-base-dir> lines
e.g.#cloud-config fqdn: host.example.com write_files: #include: write_files/ << THIS IS KEY apt: sources: salt.sources: source: "deb https://packages.broadcom.com/artifactory/saltproject-deb stable main" key: | -----BEGIN PGP PUBLIC KEY BLOCK----- -----END PGP PUBLIC KEY BLOCK----- package_update: true package_upgrade: true package_reboot_if_required: true packages: - salt-minion runcmd: - salt-call --local state.apply
-
go run main.go <directory where cloud-init.tmpl.yaml lives>
or
cloud-init-builder[platform] <directory where cloud-init.tmpl.yaml lives>
if you built the Go file or downloaded the release
- the program goes through all files until the bottom of the specified directory
- for each file, it will inlcude the content, keeping the indentation of the comment
- send the expanded file to stdout
-
pipe or send the output to an editor or file
- run
.\build-release.ps1 -BinaryName cloud-init-builder -PackagePath ./src/main.go
- run (untested)
.\build-release.bash -b cloud-init-builder -p ./src/main.go