There is no way to merge the same file in different envs if one of them has no top file.
with this config:
/etc/salt/master
top_file_merging_strategy: marge_all
pillar_roots:
base:
- /srv/pillar
- /srv/pillar/base
dev:
- /srv/pillar/dev
- /srv/pillar/base
pillar_source_merging_strategy: recurse
If we have something like this (please note, base has no top file):
pillar/base/any/init.sls
key1: base_val1
key2: val2
pillar/dev/any/init.sls
any:
key1: dev_val1
key3: val3
md5-4f02d0c232db7ccd73a3501f35783063
pillar/dev/top.sls
dev:
'*':
- any
md5-265e91391122f05ebc47ca2e4042ae80
any:
key1: dev_val1
key3: val3
md5-a0def8bd039ed28a8fbac0f7fe27e5ab
pillar/base/any1/init.sls
key1: base_val1
key2: val2
md5-4f02d0c232db7ccd73a3501f35783063
pillar/dev/any2/init.sls
any:
key1: dev_val1
key3: val3
md5-4f02d0c232db7ccd73a3501f35783063
pillar/dev/top.sls
dev:
'*':
- any1
- any2
md5-265e91391122f05ebc47ca2e4042ae80
any:
key1: dev_val1
key2: val2
key3: val3
md5-3e149c9ba7e313efa6813c6ee04dcf87
Salt Version:
Salt: 2017.7.2
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.4.2
docker-py: Not Installed
gitdb: 0.6.4
gitpython: 1.0.1
ioflo: Not Installed
Jinja2: 2.8
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: 1.0.3
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.12 (default, Nov 19 2016, 06:48:10)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.2.0
RAET: Not Installed
smmap: 0.9.0
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4
System Versions:
dist: Ubuntu 16.04 xenial
locale: UTF-8
machine: x86_64
release: 4.8.0-32-generic
system: Linux
version: Ubuntu 16.04 xenial
So, this is a limitation, by design, of the fileserver.
What happens is we look through the fileserver from the top of the pillar roots down, as soon as we find the named file once, we stop. You will either have to have them named different files, or in the one top file that you have, you have to reference both environments and the any file.
base:
'*':
- any
dev:
'*':
- any
This will have the base environment do the search for any, which will find /srv/pillar/base/any/init.sls and then the dev environment, which will search its roots top down, and find /srv/pillar/dev/any/init.sls first, then they should be merged.
Thanks,
Daniel
Most helpful comment
So, this is a limitation, by design, of the fileserver.
What happens is we look through the fileserver from the top of the pillar roots down, as soon as we find the named file once, we stop. You will either have to have them named different files, or in the one top file that you have, you have to reference both environments and the any file.
This will have the base environment do the search for any, which will find
/srv/pillar/base/any/init.slsand then the dev environment, which will search its roots top down, and find/srv/pillar/dev/any/init.slsfirst, then they should be merged.Thanks,
Daniel