I'm trying to use jinja in a pkg.installed state to create an effect similar to how pip.installed can install packages from a requirements file.
In my pillar file, I have this:
proj_root: /project
In my PACKAGES.ubuntu file I have this:
postgresql
postgresql-server-dev-9.1
postgresql-contrib-9.1
Then in my sls file, I have this:
{% set pkgfile = salt['pillar.get']('proj_root') + "/installation/PACKAGES.ubuntu" %}
os-pkgs:
pkg.installed:
- pkgs:
{% for pkgname in pkgfile %}
- {{ pkgname }}
{% endfor %}
Now, my salt root and salt states are in a subdirectory of my project.
The PACKAGES.ubuntu file is in a different subdirectory.
Using the above, I keep getting this error:
MinionError: Unsupported path: /project/installation/PACKAGES.ubuntu
I also tried to use import and include on the pkgfile, but I get the same error. I know that my set pkgfile statement is correct because the error message prints out the correct path.
Has anyone successfully read the contents of a file outside of the salt root into a variable and used those contents to create parts of the state declaration? What am I doing wrong? This seems like it should be very simple.
P.S. I am open to using a renderer other than jinja if that would make it easier. But I cannot move the location of the PACKAGES file, so I need to read it where it sits.
Thanks,
Nick