8
votes

I have a repository with salt states for provisioning my cluster of servers in the cloud. Over time, I kept on adding more states - the .sls files - into this repo. Now im starting to struggle what is what and what is where.

I am wondering if there is a there is some software utility/package that will generate documentation off my states repository, preferably as html pages, so that I can browse them and see their interdependencies.

UPDATE:

The state sls files look like this:

include:
    - states.core.pip

virtualenv:
    pip.installed:
        - require:
            - sls: states.core.pip

virtualenvwrapper:
    pip.installed:
        - require:
            - sls: states.core.pip

And another sls example:

{% set user_home = '/home/username' %}

my_executable_virtualenv:
    virtualenv.managed:
        - name: {{ user_home }}/.virtualenvs/my_executable_virtualenv
        - user: username
        - system_site_packages: False
        - pip_pkgs:
            - requests
            - numpy
        - pip_upgrade: True
        - require:
            - sls: states.core

my_executable_supervisor_entry:
    file.managed:
        - name: /etc/supervisor/conf.d/my_executable.conf
        - source: salt://files/supervisor_config/my_executable.conf
        - user: username
        - group: username
        - mode: 644
        - makedirs: False
        - require:
            - sls: states.core
2
In what format are your sls files? yaml? - Tschallacka
@Tschallacka Yes. I have updated the question and added examples. - dopstar

2 Answers

0
votes

I did some research and found that salt stack has created one. It does work as HTML pages too. According to the documentation. If you have python installed installing Sphinx is as easy as doing C:\> pip install sphinx
Salt-stacks docs on this can be found here. According to the docs making the HTML documentation is as easy as doing:

cd /path/to/salt/doc
make HTML

I hope this answer is what you were looking for!

0
votes

This needs a custom plugin which needs to be written. There is no plugins directly available to render sls files.

There are some plugins available for rendering YAML files, may be you can modify the same to suite your requirement.