Skip to main content

Create a yaml file from a template and automatically embed local files.

Create builds for your cloud-init / cloud-config templates with ease!

This allows you to edit files and track in source control and wrap them in yaml files when needed. Supports compression to minimize yaml size (perfect to squeeze into startup scripts for AWS/EC2 instances).

File graphic by href="http://www.flaticon.com/authors/freepik - made by http://logomakr.com

Getting started

pip install yamlifier

cd testdata

yamlifier VARIABLE1="funny person"

Check out the generated.yaml file in the local folder. Use -f to overwrite existing file and –help for more information.

Template Syntax

#cloud-config
#@ Comments like this will be removed from the generated file.
runcmd:
  - [ /example/install.sh ]

write_files:
  #@ 'local-content-path' will be replaced with content of local file.
  - path: /example/install.sh
    permissions: "0755"
    owner: "root"
    local-content-path: example_files/install.sh

  #@ Embed binary file as an example (could be an executable)
  - path: /example/small_logo.png
    permissions: "644"
    owner: "root"
    local-content-path: example_files/small_logo.png

  #@ Embed archive with multiple small files
  #@ 'local-content-tar-path' will be replaced with an embedded archive with all files in folder.
  - path: /example/archive.tgz
    permissions: "644"
    owner: "root"
    local-content-tar-path: example_files/subfolder

Building & Testing using Docker

Check out the git repository and from the yamlifier folder:

docker build -t yamlifier2 -f docker/python2.Dockerfile .

docker run -it -v $PWD:/code yamlifier2 bash

Credits

Based on the excellent ruamel.yaml library that allows manipulating yaml files while preserving comments and order.

Logo created with logomakr.com (image CC BY 3.0 license).

Source code and feedback

Fully open sourced with Apache License on github.com/sverrirab/yamlifier including issue tracking.

Metadata

Release files for yamlifier 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yamlifier 1.0.3
File Size Uploaded
yamlifier-1.0.3.tar.gz 9.5 kB Details

Release files / yamlifier-1.0.3.tar.gz

Download URL yamlifier-1.0.3.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9239e15ca69c88f33ebb7203cc52278ec422dd99948c138358c6cad69722b742
BLAKE2b-256 checksum
How to use checksums
111669df90499e866872abb0457a02f2c4a68b85f0f8f92c1b087d3690b481a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release history Release notifications | RSS feed

This release

1.0.3 This release

1 release file

1.0.2

1 release file

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page