mirror of
https://github.com/geerlingguy/mac-dev-playbook
synced 2024-11-24 21:03:26 +00:00
Fix passwordless sudo for vagrant when GNU sed is installed
This commit is contained in:
parent
58e256cb62
commit
1c5bbd2a08
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).
|
||||
- name: Copy sudoers configuration into place.
|
||||
copy:
|
||||
src: files/etc/sudoers
|
||||
template:
|
||||
src: templates/sudoers.j2
|
||||
dest: /etc/sudoers
|
||||
mode: 0440
|
||||
validate: 'visudo -cf %s'
|
||||
become: yes
|
||||
when: configure_sudoers
|
||||
|
|
|
@ -47,7 +47,7 @@ root ALL=(ALL) ALL
|
|||
# Vagrant sudoers config
|
||||
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
|
||||
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_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
|
Loading…
Reference in a new issue