Skip to content

Commit 2dc641d

Browse files
committed
Fixes #33: Don't overwrite sudoers file by default, and use sudoers.d.
1 parent 5b15ad9 commit 2dc641d

File tree

5 files changed

+18
-60
lines changed

5 files changed

+18
-60
lines changed

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
sudo: required
33
language: objective-c
44

5+
env:
6+
global:
7+
- ANSIBLE_FORCE_COLOR=true
8+
59
# Reference for OS X Versions:
610
# https://docs.travis-ci.com/user/reference/osx/#macos-version
711
matrix:
@@ -60,11 +64,11 @@ script:
6064
- "cp tests/config.yml config.yml"
6165

6266
# Test the playbook.
63-
- "travis_wait 30 ansible-playbook --extra-vars '{\"configure_sudoers\":\"false\"}' main.yml"
67+
- "travis_wait 30 ansible-playbook main.yml"
6468

6569
# Test the playbook's idempotence.
6670
- idempotence=$(mktemp)
67-
- "ansible-playbook --extra-vars '{\"configure_sudoers\":\"false\"}' main.yml | tee -a ${idempotence}"
71+
- "ansible-playbook main.yml | tee -a ${idempotence}"
6872
- >
6973
tail ${idempotence}
7074
| grep -q 'changed=0.*failed=0'

ansible.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[defaults]
2+
nocows = True
23
roles_path = ./roles:/etc/ansible/roles
34

45
[ssh_connection]

default.config.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22
downloads: ~/.ansible-downloads/
33

44
configure_dotfiles: yes
5-
configure_sudoers: yes
65
configure_terminal: yes
76
configure_osx: yes
87

8+
configure_sudoers: no
9+
sudoers_custom_config: ''
10+
# Example:
11+
# sudoers_custom_config: |
12+
# # Allow users in admin group to use sudo with no password.
13+
# %admin ALL=(ALL) NOPASSWD: ALL
14+
915
dotfiles_repo: https://github.com/geerlingguy/dotfiles.git
1016
dotfiles_repo_accept_hostkey: yes
1117
dotfiles_repo_local_destination: ~/Development/GitHub/dotfiles

tasks/sudoers.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
sed_path: "{{ sed_which_result.stdout }}"
1212
when: sed_path is undefined
1313

14-
# Sudoers configuration (enables more convenient Vagrant usage).
14+
# Sudoers configuration.
1515
- name: Copy sudoers configuration into place.
16-
template:
17-
src: templates/sudoers.j2
18-
dest: /etc/sudoers
16+
copy:
17+
content: "{{ sudoers_custom_config }}"
18+
dest: /private/etc/sudoers.d/custom
1919
mode: 0440
2020
validate: 'visudo -cf %s'
2121
become: yes

templates/sudoers.j2

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)