Salt-minion as non-root user to execute sudo commands always returns error "The function 'state.highstate' is running as PID.."

时间:2015-07-28 22:12:58

标签: python linux salt-stack

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 个答案:

答案 0 :(得分:0)

尝试重新启动salt-minion守护程序。如果这不起作用,请尝试删除/var/cache/salt/master/proc目录并重新启动salt-minion守护程序。

您看到的错误是Salt检查是否正在运行另一个高状态并阻止您运行另一个状态。你需要确保它没有这样做。

答案 1 :(得分:0)

我遇到过这个问题。我尝试清理缓存,重新启动minion但没有工作。你需要杀死这个过程。

salt '*' saltutil.kill_job 20150728155808625398

答案 2 :(得分:-2)

我不知道你是什么。你需要找到你在minion上'state.highstate'开始的进程然后杀死它。 Saltstack只允许同时运行一个.sls文件。如果您没有终止进程,则无法高举其他.sls文件。