Metadata-Version: 2.1
Name: yamlifier
Version: 1.0.2
Summary: Utility to create yaml files from a template. Perfect for cloud-config or cloud-init creation.
Home-page: https://github.com/sverrirab/yamlifier
Author: Sverrir Á. Berg
License: Apache
Keywords: yaml,cloud-init,cloud-config
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Intended Audience :: Information Technology
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development :: Libraries :: Python Modules
License-File: LICENSE.rst

yamlifier
==============

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).

.. image:: https://raw.githubusercontent.com/sverrirab/yamlifier/main/logo.png
    :width: 200px
    :align: center
    :alt: File graphic by href="http://www.flaticon.com/authors/freepik - made by http://logomakr.com

Getting started
---------------

.. code:: bash

    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
---------------

.. code:: yaml

    #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:

.. code:: bash

    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.

.. _ruamel.yaml: https://pypi.python.org/pypi/ruamel.yaml

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

.. _logomakr.com: http://logomakr.com


Source code and feedback
------------------------

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

.. _Apache License: https://github.com/sverrirab/yamlifier/blob/master/LICENSE.rst
.. _github.com/sverrirab/yamlifier: https://github.com/sverrirab/yamlifier


