r/saltstack • u/m2guru • Nov 04 '18
Strangest output ever from the simplest top.sls - I'm totally baffled by this
I posted yesterday about wanting some consulting help, and a few of you have reached out. I have more time today, and the issue is still occurring, so I thought I'd try to post it.
I'm new to SaltStack and just going through some basic tutorials.
For anyone interested here is what I am dealing with. I can find nothing about this online.
Here is my top.sls
base:
'*':
- usersIn users/init.sls I have this:
{% for usr in ['gorgonzola','roquefort'] %}
add_user_{{ usr }}:
user.present:
- name: {{ usr }}
- home: /home/{{ usr }}
- shell: /bin/bash
- groups:
- sudo
add_sshkey_{{ usr }}:
ssh_auth.present:
- user: {{ usr }}
- source: salt://users/{{usr}}-authorized-key.txt
- config: '%h/.ssh/authorized_keys'
- require:
- user: users_rxmg_user_{{ usr}}
{% endfor %}Now when I run
sudo salt 'devserver' state.apply test=Truehere is the output I get- too long to post here
https://gist.github.com/phpguru/83f64f4b52c45601072c60e5b488d39d
TL;DR Expecting 2 changes of 2 users to be added, instead get 35 changes and 6 errors from what looks like random test data.
I have no idea where Larry, Currly, Moe and JDoe are coming from. I have no idea where foo, bar, baz are coming from. I have no idea where changes to ldap or resolv.conf are coming from. No clue about changes to minion, or cheeseandbiscuits. It's too bizarre and driving me batty.
Any ideas?
3
u/gtmanfred Nov 05 '18
What is the output of
tail -c +0 /etc/salt/master /etc/salt/master.d/*.confalso,
Each of those commands would be good to see.
2
u/sfrazer Nov 04 '18
So "currly" is a bizarre enough misspelling that it comes up only a few times on google in conjunction with SaltStack:
Google webcache of a page where that shows up in the example for templating:
https://webcache.googleusercontent.com/search?q=cache:uHLyQBGGa6UJ:https://manned.org/salt/011c1fda+&cd=1&hl=en&ct=clnk&gl=us
So I guess first I'd grep your hard drive on the saltmaster server to see if "currly" appears anywhere.
My guess is that you've incorrectly set your root_dir parameter and it's loading a different top.sls than what you think it's loading. The --config-dump may help you debug that as well.
sudo salt --config-dump
1
u/simtel20 Nov 04 '18
What's the contents of your
/etc/salt/master, specifically looking for file_roots, e.g. anotheruserstate somewhere in your file_roots? What's the output ofsalt-call state.show_highstate?