Browse Source

Automatically set up passwordless sudo for deploy user.

Closes #343.
Alex Payne 9 years ago
parent
commit
b11fb68559
3 changed files with 5 additions and 3 deletions
  1. 1
    3
      README.md
  2. 3
    0
      roles/common/tasks/users.yml
  3. 1
    0
      roles/common/templates/sudoers.j2

+ 1
- 3
README.md View File

@@ -129,9 +129,7 @@ Authorize your ssh key if you want passwordless ssh login (optional):
129 129
     chmod 400 /home/deploy/.ssh/authorized_keys
130 130
     chown deploy:deploy /home/deploy -R
131 131
 
132
-This account should be set up for passwordless sudo. Use `visudo` and add this line:
133
-
134
-    deploy  ALL=(ALL) NOPASSWD: ALL
132
+Your new account will be automatically set up for passwordless `sudo`.
135 133
 
136 134
 ### 4. Configure your installation
137 135
 

+ 3
- 0
roles/common/tasks/users.yml View File

@@ -1,2 +1,5 @@
1 1
 - name: Create main user account
2 2
   user: name={{ main_user_name }} state=present shell={{ main_user_shell }} groups=sudo,fuse
3
+
4
+- name: Give main user account sudo power
5
+  template: src=roles/common/templates/sudoers.j2 dest=/etc/sudoers.d/sudoers owner=root group=root mode=0440 validate='visudo -cf %s'

+ 1
- 0
roles/common/templates/sudoers.j2 View File

@@ -0,0 +1 @@
1
++{{ main_user_name }} ALL=(ALL) NOPASSWD: ALL

Loading…
Cancel
Save