(Note: I wrote this up quickly and without a lot of research, so there are probably inaccuracies. However, I wanted to put this out there in case it helps someone else hitting this issue. Github gists like this unfortunately don't have comment notifications, so if you want me to send me a comment, use my email [email protected] and not the comments.)
The ability to limit sudo users to only be able to execute certain commands doesn't work with Ansible (without a workaround).
This isn't a problem if you're running Ansible as a super-user like root
, but if you are allowing others to run Ansible on your systems in order to do things like application deploys, then you need a way to limit their access to the system for basic security.
For example, a line in /etc/sudoers
like this: