From a19180dfda49b96ff27911a71255ea3a504c4bb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 13 Nov 2018 01:01:36 +0100 Subject: Move bashrc temporary file to state dir --- roles/init/tasks/main.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'roles/init/tasks') diff --git a/roles/init/tasks/main.yml b/roles/init/tasks/main.yml index ce56ec4..a52f3cd 100644 --- a/roles/init/tasks/main.yml +++ b/roles/init/tasks/main.yml @@ -1,4 +1,16 @@ --- +- 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/Desktop" + - "$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 @@ -12,7 +24,7 @@ - name: Remove old lines in bashrc_temp lineinfile: line: "{{ ('unset ' ~ item | regex_replace('=.*')) if item != '' and item.0 != '#' else '' }}" - dest: $HOME/.bashrc_temp + dest: $XDG_STATE_HOME/bash/bashrc_temp insertafter: EOF create: true state: present @@ -21,7 +33,7 @@ - name: Add new lines in bashrc_temp lineinfile: line: "{{ ('export ' ~ item) if item != '' and item.0 != '#' else '' }}" - dest: $HOME/.bashrc_temp + dest: $XDG_STATE_HOME/bash/bashrc_temp insertafter: EOF create: true state: present @@ -31,14 +43,3 @@ 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" -- cgit v1.2.3