Reputation: 11
I have an issue with my Saltstack and its top.sls. Unfortunately, not all my states from the top.sls will be applied the minion.
Here is my top.sls
# master top.sls
base:
'G@salt_control:true':
- automount
- chrony
- columbus
- db_db2
- db_hana_tdi
- db_maxdb
- db_ora
- db_ora-nonsap
- db_sybase
- dnsmasq
- facts
- grub
- iptables_rule
- lama_sync
- ldap_hosts
- ldap_services
- logrotate
- lvm
- nsswitch
- ntp
- company_base
- company_profile
- pam_krb5
- pam_ldap
- postfix
- rear
- resolv
- rsyslog
- salt-minion
- sap_cc
- sap_ci
- sap_di
- sap_trx
- sap_wd
- ssh
- sssd
- systemd
- sysstat
- tsm
- userdef
- zypper
'G@cpuarch:ppc64le':
- lpar2rrde
And if I run a highstate on the servers, not all states will be applied. I can run any state on his own with no problem. For example the state "company_base" will not be applied by running a highstate. If I apply it alone, there is no problem.
The state will also displayed when I run "salt-call state.show_top".
Here is my Salt master config:
top_file_merging_strategy: same
fileserver_backend:
- git
- roots
state_top_saltenv: base
gitfs_remotes:
- git@gitserver:team/salt.git:
- saltenv:
- base:
- ref: master
- dev:
- ref: development
The grains (/etc/salt/grains) from my minion:
salt_control: true
Here is the content of the company_base:
{% from "company_base/map.jinja" import company_base with context %}
##
# add companyrpm signing key
company_rpm_signing_key:
cmd.run:
- name: rpm --import http://repo.company.lan/pub/RPM-GPG-KEY-COMPANY
- unless: "rpm -q gpg-pubkey | grep -q gpg-pubkey-XXXXX-XXXXXX"
##
# install company packages
company.scripts:
pkg.installed:
- name: company-dep-scripts
- refresh: true
##
# install uc4
uc4_packages:
pkg.installed:
- pkgs:
- uc4
##
# install default packages
default_base_packages:
pkg.installed:
- pkgs:
{% set pkg_list = company_base.pkgs.get(grains.cpuarch) %}
{% for pkg in pkg_list %}
- {{ pkg }}
{% endfor %}
getroot_sudo:
file.managed:
- name: /etc/sudoers.d/01-admin
- contents:
- "# salt managed {{ sls }}"
- "%basis ALL=NOPASSWD:/bin/su - admin"
- "admin ALL=(ALL) NOPASSWD:ALL"
- user: root
- group: root
- mode: 440
The jinja map:
{% set company_base = salt['grains.filter_by']({
'Suse': {
'pkgs': {
'x86_64': [
'"hostinfo"',
'"tcpdump"',
'"uc4"',
'"getroot"',
'"libX11-6-32bit"',
'"company-dep-pa-001"',
'"pmg_scripts"',
'"company-dep-scripts"',
'"pam_ssh"',
'"psmisc"',
'"telnet"',
'"tcsh"',
'"libgcc_s1"',
'"libatomic1"',
],
'ppc64le': [
'"hostinfo"',
'"tcpdump"',
'"uc4"',
'"getroot"',
'"company-dep-pa-001"',
'"pmg_scripts"',
'"company-dep-scripts"',
'"psmisc"',
'"telnet"',
'"tcsh"',
'"libgcc_s1"',
'"libatomic1"',
],
},
},
} ) %}
Any ideas?
Upvotes: 0
Views: 783
Reputation: 38777
I suspect it's due to you having multiple environments defined via gitfs, but only base
in your top file.
Given your config, try replacing base:
with {{ saltenv }}:
(in all branches), so it's mapped correctly and not merged with anything else.
Upvotes: 0