Skip to main content

Utility to create yaml files from a template. Perfect for cloud-config or cloud-init creation.

Project description

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/greenqloud/yamlifier including issue tracking.

Background

This was created by Greenqloud when developing Qstack.

Hope you find it useful!

Greenqloud Dev Team.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
yamlifier-1.0.1-py2.py3-none-any.whl (7.4 kB) Copy SHA256 hash SHA256 Wheel py2.py3
yamlifier-1.0.1.tar.gz (5.3 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page