Last active
June 15, 2017 00:12
-
-
Save z3cka/ba9c2034ff705b52282b814e66bb8c38 to your computer and use it in GitHub Desktop.
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
# do: | |
- name: Create user, ansible, with a key & wheel | |
user: | |
name: ansible | |
shell: /bin/bash | |
groups: wheel | |
# don't: | |
- name: Allow the ansible user to sudo to root by adding it to the wheel group in /etc/group | |
lineinfile: | |
path: /etc/group | |
backup: yes | |
# match 'wheel:x:10:' not followed by 'ansible' | |
regexp: '(wheel:x:10:(?!ansible))(.*)' | |
# insert 'ansible' into line | |
# example: | |
# before: wheel:x:10:cgrzecka | |
# after: wheel:x:10:ansible,cgrzecka | |
line: '\1ansible,\2' | |
backrefs: yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment