Always work on current user, no hardcoding

This commit is contained in:
2018-02-08 21:44:41 +01:00
parent 36078669bc
commit 9cc8b2e915

View File

@@ -2,16 +2,19 @@
connection: local
become: false
tasks:
- set_fact:
user: "{{ ansible_user_id }}"
- name: configure sudoers
lineinfile:
path: /etc/sudoers
line: hannes ALL=(ALL) NOPASSWD:ALL
regexp: '^hannes\s+'
line: "{{ user }} ALL=(ALL) NOPASSWD:ALL"
regexp: "^{{ user }}\\s+"
become: true
- name: set shell
user:
name: hannes
name: "{{ user }}"
shell: /usr/bin/zsh
become: true