blob: c06a07885bcff79770123092d83c232d30075dc7 (
plain) (
tree)
|
|
---
- name: Create XDG dirs
file:
path: "{{ item }}"
state: directory
loop:
- "$XDG_CONFIG_HOME"
- "$XDG_STATE_HOME"
- "$XDG_STATE_HOME/bash"
- "$XDG_DATA_HOME"
- "$XDG_CACHE_HOME"
- "$HOME/Downloads"
- name: Get gnupg runtime folder name
shell: 'GNUPGHOME=$XDG_CONFIG_HOME/gnupg gpgconf --list-dirs socketdir | sed -e "s@$XDG_RUNTIME_DIR/gnupg/@@"'
changed_when: false
register: gnupg_runtime_dir_cmd
check_mode: no
- 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: $XDG_STATE_HOME/bash/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) | regex_replace('@{HOME}', '${HOME}') if item != '' and item.0 != '#' else '' }}"
dest: $XDG_STATE_HOME/bash/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"
|