Multiple environments and master_tops (foreman)

59 views
Skip to first unread message

kiemlicz

unread,
Oct 19, 2016, 7:32:57 PM10/19/16
to Salt-users
Hello,

I have touble getting following master.d/custom setting work (multiple environments and master_tops):

interface: some_iface

autosign_file: /etc/salt/autosign.conf

external_auth:
  pam:
    saltuser:
      - '@runner'

master_tops:
  ext_nodes: /usr/bin/foreman-node

file_roots:
  base:
    - /srv/salt/base
  gui:
    - /srv/salt/gui
    - /srv/salt/base
  dev:
    - /srv/salt/dev
    - /srv/salt/gui
    - /srv/salt/base

ext_pillar:
  - puppet: /usr/bin/foreman-node

pillar_roots:
  base:
    - /srv/pillar/custom
    - /srv/pillar/base
  gui:
    - /srv/pillar/gui
    - /srv/pillar/base
  dev:
    - /srv/pillar/custom
    - /srv/pillar/dev
    - /srv/pillar/gui
    - /srv/pillar/base
  custom:
    - /srv/pillar/custom

pillar_merge_lists: True

rest_cherrypy:
    port: some_port
    host: some_host
    ssl_key: key_path
    ssl_crt: crt_path

output from foreman-node (which supplies "master_tops") e.g.

---
classes:
- base_pkgs
- hosts
parameters:
 puppetmaster: ''
 domainname: domain
 foreman_domain_description: home
 root_pw: "$pass"
 owner_name: Admin User
 owner_email: root@domain
 foreman_subnets:
 - name: domain
   network: xxx
   mask: 255.255.255.0
   gateway: xxx
   dns_primary: ''
   dns_secondary: ''
   from: ''
   to: ''
   boot_mode: DHCP
   ipam: None
   vlanid: ''
   network_type: IPv4
 foreman_interfaces:
 - ip: some_ip
   mac: some_mac
   name: blabla.com
   attrs: {}
   virtual: false
   link: true
   identifier: eth0
   managed: true
   primary: true
   provision: true
   subnet:
     name: domain
     network: xxxx
     mask: 255.255.255.0
     gateway: xxxx
     dns_primary: ''
     dns_secondary: ''
     from: ''
     to: ''
     boot_mode: DHCP
     ipam: None
     vlanid: ''
     network_type: IPv4
   subnet6:  
   tag:  
   attached_to:  
   type: Interface
 install-disk: "/dev/sda"
 salt_master: some_master
environment: base

What I expect to see after salt 'host' state.show_top are states limited by master_tops? In this case only:
- base_pkgs
- hosts
from base environment. Whereas I see all the states from all environments. 
Running state.apply also runs all the states from all the environments. Which is not what I expect.
I expect it to run only base_pkgs and hosts.
My top files:

base/top.sls
base:
  '*':
    - hosts
    - repositories
    - base_pkgs
    - mounts
    - samba

  'not G@os:Windows':
    - match: compound
    - users
    - users_dotfiles

gui/top.sls
gui:
  'gpus:vendor:nvidia':
    - match: grain
    - nvidia_driver

  'not G@os:Windows':
    - window_manager

  '*':
    - base_pkgs_gui
    - browsers
 
dev/top.sls
dev:
  '*':
    - java
    - scala
    - projects
    - redis
  'not G@biosversion:VirtualBox':
    - virtualbox

Running salt 2016.3.3

Is there any mistake? Basically I want to run only states returned from foreman-node (and from environment returned by foreman-node)
Thank you in advance.

kiemlicz

unread,
Oct 27, 2016, 6:29:32 AM10/27/16
to Salt-users
Given number of replies, is there anyone using master_tops and multiple environments setup?
Reply all
Reply to author
Forward
0 new messages