Created
February 19, 2018 03:29
-
-
Save karayok/a0f0a13be38ae0382f4dd23b1c2816b1 to your computer and use it in GitHub Desktop.
Ansible role to add sudoers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# role/user/tasks/main.yml | |
- name: Add sudoers settings | |
become: yes | |
template: | |
dest: '/etc/sudoers.d/bar' | |
src: 'sudoers-myapp' | |
mode: 0440 | |
tags: user-group | |
- name: Restart sshd | |
service: | |
name: ssh | |
state: restarted | |
tags: user-group |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# role/user/templates/sudoers-myapp | |
Cmnd_Alias MY_APP = /bin/systemctl start myappd.service , /bin/systemctl stop myappd.service , /bin/systemctl status myappd.service | |
bar ALL = (root) NOPASSWD:/bin/su, MY_APP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment