Category: Feature Request
I use SaltStack in masterless mode, and my main usage pattern is sudo salt-call --local state.apply. I use sudo is because I use salt to manage nginx, redis, etc. whose configuration files are only editable by root. As the result, I need to use the - runas argument of cmd.run module whenever I need to run a command not as root.
I need to run djangomod.collectstatic, and module not as root, because otherwise the collected static files cannot be served by web servers like nginx, etc. Besides djangomod.collectstatic, I also need to run djangomod.command as non-root user for some management tasks. However, djangomod does not currently accept runas argument or the likes.
Since djangomod is implemented by calling cmd.run module, this behaviour is actually simple to achieve. We can modify the last line of djangomod.command:
__salt__['cmd.run'](cmd, env=env, python_shell=False)
either by explicitly reading and passing runas argument or passing **kwargs altogether to cmd.run.
I would love to hear opinion from the core salt team about this. I think this usage pattern should be fairly common to saltstack users who manage a django deployment. Hence this feature would benefit many. I would be happy to provide a pull request.
My recommendation would be to only pass runas to cmd.run, and not all of kwargs.
I have dropped this into our #dev channel on slack and asked for more feed back for you if anyone else has time.
Thanks!
Daniel
Thank you @gtmanfred. I have been browsing other issues and I noticed my use case seems like a subset of a more general feature request #37835 "Make "runas" a global state argument iso specific to cmd.run". Do you think so?
Yup, I would agree with that.
On Tue, Feb 7, 2017 at 9:44 PM andhieka notifications@github.com wrote:
Thank you @gtmanfred https://github.com/gtmanfred. I have been browsing
other issues and I noticed my use case seems like a subset of a more
general feature request #37835
https://github.com/saltstack/salt/issues/37835 "Make "runas" a global
state argument iso specific to cmd.run". Do you think so?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/saltstack/salt/issues/39224#issuecomment-278221127,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAssoZqVXHBq7hbYOdDcwkjASES7FEknks5raToegaJpZM4L5r-q
.
But I'm not sure whether anyone has started working on #37835. Moreover, it seems more difficult and I don't know where to start if I were to help 😅
In that case, I am going to close this as a duplicate of #37835
Thanks,
Daniel
We will see how this is taken https://github.com/saltstack/salt/pull/39248
:D
Most helpful comment
We will see how this is taken https://github.com/saltstack/salt/pull/39248
:D