0

New to saltstack, I have created a base environment and seems to be working fine. Now I'm trying to setup a dev and prod environment so I can have have custom modules along with also adding some from the base environment.

However even with setting up a dev environment in my master config, all base and dev minions are getting the same modules.

These are the changes made to the salt master config file (etc/salt/master)

File Server setting

file_roots:
  base:
    - /opt/base/
  dev:
    - /opt/dev/
    - /opt/base/
  prod:
    - /opt/prod/


top_file_merging_strategy: same

Node Groups

nodegroups:
  dev: 'L@rnd301.com,rnd302.com,rnd304.com,rnd305.com'

Pillar settings

pillar_roots:
  base:
    - /opt/pillar
  dev:
    - /opt/dev/pillar


This is the dev top.sls config

dev:
  '*':
    - pw_new

base:
  '*':
    - sudo
    - sshkeys

Base top.sls config

base:
  '*':
    - common
    - sudo
    - dns
    - ntp
    - repos
    - history
    - rootpw
    

When i run the salt-call i see that all the base files hit the dev minion along with base minions.


      ID: pw_new
Function: user.present
  Result: True
 Comment: User rootpw_new is present and up to date
 Started: 12:39:09.350877
Duration: 4.361 ms
 Changes:

Summary for local

Succeeded: 49

fndogonza
  • 1
  • 2

1 Answers1

0
  dev:
    - /opt/dev/
    - /opt/base/

You told it that the dev environment includes everything in base. So it merges both /opt/dev/top.sls and /opt/base/top.sls, and then the '*' matches every minion.

OrangeDog
  • 36,653
  • 12
  • 122
  • 207
  • That makes sense So what would be best practice on setting up a base, dev and prod environment? I want to be able to use some of the base items in different environments. – fndogonza Jul 03 '23 at 15:49