blob: 1baec91605a47ef51220a03863586bbe83323931 (
plain) (
blame)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
---
- name: Get gnupg runtime folder name
shell: 'GNUPGHOME=$XDG_CONFIG_HOME/gnupg gpgconf --list-dirs socketdir | sed -e "s@$XDG_RUNTIME_DIR/gnupg/@@"'
register: gnupg_runtime_dir_cmd
- name: Add pam_environment
register: pam_environment
template:
src: pam_environment.j2
dest: $XDG_CONFIG_HOME/pam_environment
- name: Remove old lines in bashrc_temp
lineinfile:
line: "{{ ('unset ' ~ item | regex_replace('=.*')) if item != '' and item.0 != '#' else '' }}"
dest: $HOME/.bashrc_temp
insertafter: EOF
create: true
state: present
loop: "{{ pam_environment.diff.0.before.split('\n')|difference(pam_environment.diff.0.after.split('\n')) | regex_replace('[\\\\t]*DEFAULT') }}"
when: pam_environment.changed
- name: Add new lines in bashrc_temp
lineinfile:
line: "{{ ('export ' ~ item) if item != '' and item.0 != '#' else '' }}"
dest: $HOME/.bashrc_temp
insertafter: EOF
create: true
state: present
loop: "{{ pam_environment.diff.0.after.split('\n')|difference(pam_environment.diff.0.before.split('\n')) | regex_replace('[\\\\t]*DEFAULT', '') }}"
when: pam_environment.changed
- name: Signal the change
when: pam_environment.changed
debug:
msg: "\u26A0\uFE0F \u26A0\uFE0F You need to log out and back in to update your environment \u26A0\uFE0F \u26A0\uFE0F"
- name: Create XDG dirs
file:
path: "{{ item }}"
state: directory
loop:
- "$XDG_CONFIG_HOME"
- "$XDG_STATE_HOME"
- "$XDG_DATA_HOME"
- "$XDG_CACHE_HOME"
- "$HOME/Desktop"
- "$HOME/Downloads"
|