3
votes

I am trying to configure the salt-minion to run as a non-root user but run all its commands via a sudo user which seems possible with the latest salt release

I created the my-minion user, gave it sudo privileges and made sure that no password is required for command execution and configured the minion accordingly.

/etc/sudoers

# sudo privileges and permission to execute cmds with no password
my-minion ALL=(ALL) NOPASSWD:ALL

/etc/salt/minion

# The user to run salt.
user: my-minion
sudo_user: root

However after executing salt '*' state.highstate, the minion always returns the following error -

/var/log/salt/minion

The function "state.highstate" is running as PID 17121 and was started at 2015, Jul 28 15:58:08.625398 with jid 20150728155808625398

There's not anything particularly helpful in the debug logs apart from the fact that the state.highstate is getting LazyLoaded twice. I do have the logs with me. Let me know if those are required.

I am pretty sure I configured everything properly according to the following docs-

  1. Running the salt master/minion as an unprivileged user
  2. Sudo minion settings

The salt version I am using is 2015.5.3 (Lithium) and the operating system is CentOS 6.6

NOTE: The error goes away when I simply comment the sudo_user property in the minion config file but obviously I don't get the functionality that I was looking for. So pretty sure that this is a problem because of that attribute only and not anything else.

I would appreciate if anyone can point me in the right direction OR clarify if this is a bug in salt's implementation.

3
isn't it a lot easier if you just sudo su or whatever to become root and then do what you want?or is that against your whole purpose?tudoricc
Running everything as root works like a charm but yes that is against the purpose of what I am trying to achieve.Shikhar

3 Answers

0
votes

Try restarting your salt-minion daemon. If that doesn't work try deleting your /var/cache/salt/master/proc directory and restarting the salt-minion daemon.

The error you're seeing is Salt checking to see if another highstate is running and stopping you from running another. You need to make sure it's not doing so.

0
votes

I have faced this issue. I tried cleaning cache, restarting minion but did not work. You need to kill the process.

salt '*' saltutil.kill_job 20150728155808625398
-2
votes

I don't know what you .sls is. You need to find what process you started by 'state.highstate' on minion and kill it. Saltstack just allows to run one .sls file at the same time. If you don't kill the process, it can't highstate another .sls file.