Search code examples
salt-project

Standalone masterless Salt minion won't pick up matching pillar


I have a standalone minion installed on the web1 server:

me@web1:~$ hostname
web1

me@web1:~$ sudo salt-call network.get_hostname
local:
    web1

me@web1:~$ cat /etc/salt/minion|egrep -v '^#'|egrep -v '^$'
file_client: local
file_roots:
  base:
    - /srv/salt
pillar_roots:
  base:
    - /srv/pillar

My pillar is set up something like this:

me@web1:~$ cat /srv/pillar/top.sls
base:
  '*':
    - db
  'web1':
    - env.production

me@web1:~$ cat /srv/pillar/db.sls
postgres:
  use_upstream_repo: true
  version: '9.6'
  pkg: 'postgresql-9.6'
  pkg_client: 'postgresql-client-9.6'

me@web1:~$ cat /srv/pillar/env/production.sls
env: production

But when I use pillar.items, I only see this:

me@web1:~$ sudo salt-call pillar.items
local:
    ----------
    postgres:
        ----------
        use_upstream_repo:
            True
        version:
            9.6
        pkg:
            postgresql-9.6
        pkg_client:
            postgresql-client-9.6

The standalone server seems to only be applying pillars in the '*' match-all section, but not the direct-match 'web1' hostname section. What am I doing wrong here?


Solution

  • the top file matches the minion_id that may be different from the hostname (for instance it may be the FQDN or something manually set by you).

    Can you check the content of /etc/salt/minion_id? That's the minion_id salt is going to match in the top file