mirror of
https://github.com/geerlingguy/mac-dev-playbook
synced 2024-11-22 11:53:08 +00:00
Merge pull request #47 from generoi/issue-46
Fix passwordless sudo for vagrant when GNU sed is installed
This commit is contained in:
commit
4ec9ad7c13
2 changed files with 16 additions and 5 deletions
|
@ -1,10 +1,21 @@
|
||||||
---
|
---
|
||||||
|
# If the user installs GNU sed through homebrew the path is different.
|
||||||
|
- name: Register path to sed.
|
||||||
|
command: which sed
|
||||||
|
register: sed_which_result
|
||||||
|
changed_when: false
|
||||||
|
when: sed_path is undefined
|
||||||
|
|
||||||
|
- name: Define sed_path variable.
|
||||||
|
set_fact:
|
||||||
|
sed_path: "{{ sed_which_result.stdout }}"
|
||||||
|
when: sed_path is undefined
|
||||||
|
|
||||||
# Sudoers configuration (enables more convenient Vagrant usage).
|
# Sudoers configuration (enables more convenient Vagrant usage).
|
||||||
- name: Copy sudoers configuration into place.
|
- name: Copy sudoers configuration into place.
|
||||||
copy:
|
template:
|
||||||
src: files/etc/sudoers
|
src: templates/sudoers.j2
|
||||||
dest: /etc/sudoers
|
dest: /etc/sudoers
|
||||||
mode: 0440
|
mode: 0440
|
||||||
validate: 'visudo -cf %s'
|
validate: 'visudo -cf %s'
|
||||||
become: yes
|
become: yes
|
||||||
when: configure_sudoers
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ root ALL=(ALL) ALL
|
||||||
# Vagrant sudoers config
|
# Vagrant sudoers config
|
||||||
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
|
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
|
||||||
Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart
|
Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart
|
||||||
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports
|
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = {{ sed_path }} -E -e /*/ d -ibak /etc/exports
|
||||||
Cmnd_Alias VAGRANT_HOSTS_ADD = /bin/sh -c echo "*" >> /etc/hosts
|
Cmnd_Alias VAGRANT_HOSTS_ADD = /bin/sh -c echo "*" >> /etc/hosts
|
||||||
Cmnd_Alias VAGRANT_HOSTS_REMOVE = /usr/bin/sed -i -e /*/ d /etc/hosts
|
Cmnd_Alias VAGRANT_HOSTS_REMOVE = {{ sed_path }} -i -e /*/ d /etc/hosts
|
||||||
%admin ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD, VAGRANT_EXPORTS_REMOVE, VAGRANT_HOSTS_ADD, VAGRANT_HOSTS_REMOVE
|
%admin ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD, VAGRANT_EXPORTS_REMOVE, VAGRANT_HOSTS_ADD, VAGRANT_HOSTS_REMOVE
|
Loading…
Reference in a new issue