-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvars.yml
26 lines (20 loc) · 793 Bytes
/
vars.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# vars.yml
home_dir: "{{ ansible_env['PWD'] }}"
local_user: "{{ ansible_user }}"
# Use a fact gathering approach here to avoid redundancy
local_user_primary_group: "{{ lookup('pipe', 'id -gn ' + ansible_env.SUDO_USER | default(ansible_user_id)) }}"
### For future reference. Previously in main.yml ###
# pre_tasks:
# - name: Set home directory fact
# set_fact:
# home_dir: "{{ ansible_env['PWD'] }}"
# - name: Set local user fact
# set_fact:
# local_user: "{{ ansible_user }}"
# - name: Get user's primary group name
# command: "id -gn {{ ansible_env.SUDO_USER | default(ansible_user_id) }}"
# register: global_primary_group
# changed_when: false
# - name: Set user's primary group fact
# set_fact:
# local_user_primary_group: "{{ global_primary_group.stdout }}"