diff options
author | Ismaël Bouya <ismael.bouya@fretlink.com> | 2018-11-13 01:01:36 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@fretlink.com> | 2018-11-13 01:01:36 +0100 |
commit | a19180dfda49b96ff27911a71255ea3a504c4bb1 (patch) | |
tree | d33419cdf0534f7aaf259a4d85e5c707ba2016ee /roles/init/tasks | |
parent | d0a835a44b3fd25267c3c8c6d3ed12e1e628816b (diff) | |
download | Ansible-a19180dfda49b96ff27911a71255ea3a504c4bb1.tar.gz Ansible-a19180dfda49b96ff27911a71255ea3a504c4bb1.tar.zst Ansible-a19180dfda49b96ff27911a71255ea3a504c4bb1.zip |
Move bashrc temporary file to state dir
Diffstat (limited to 'roles/init/tasks')
-rw-r--r-- | roles/init/tasks/main.yml | 27 |
1 files changed, 14 insertions, 13 deletions
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 @@ | |||
1 | --- | 1 | --- |
2 | - name: Create XDG dirs | ||
3 | file: | ||
4 | path: "{{ item }}" | ||
5 | state: directory | ||
6 | loop: | ||
7 | - "$XDG_CONFIG_HOME" | ||
8 | - "$XDG_STATE_HOME" | ||
9 | - "$XDG_STATE_HOME/bash" | ||
10 | - "$XDG_DATA_HOME" | ||
11 | - "$XDG_CACHE_HOME" | ||
12 | - "$HOME/Desktop" | ||
13 | - "$HOME/Downloads" | ||
2 | - name: Get gnupg runtime folder name | 14 | - name: Get gnupg runtime folder name |
3 | shell: 'GNUPGHOME=$XDG_CONFIG_HOME/gnupg gpgconf --list-dirs socketdir | sed -e "s@$XDG_RUNTIME_DIR/gnupg/@@"' | 15 | shell: 'GNUPGHOME=$XDG_CONFIG_HOME/gnupg gpgconf --list-dirs socketdir | sed -e "s@$XDG_RUNTIME_DIR/gnupg/@@"' |
4 | changed_when: false | 16 | changed_when: false |
@@ -12,7 +24,7 @@ | |||
12 | - name: Remove old lines in bashrc_temp | 24 | - name: Remove old lines in bashrc_temp |
13 | lineinfile: | 25 | lineinfile: |
14 | line: "{{ ('unset ' ~ item | regex_replace('=.*')) if item != '' and item.0 != '#' else '' }}" | 26 | line: "{{ ('unset ' ~ item | regex_replace('=.*')) if item != '' and item.0 != '#' else '' }}" |
15 | dest: $HOME/.bashrc_temp | 27 | dest: $XDG_STATE_HOME/bash/bashrc_temp |
16 | insertafter: EOF | 28 | insertafter: EOF |
17 | create: true | 29 | create: true |
18 | state: present | 30 | state: present |
@@ -21,7 +33,7 @@ | |||
21 | - name: Add new lines in bashrc_temp | 33 | - name: Add new lines in bashrc_temp |
22 | lineinfile: | 34 | lineinfile: |
23 | line: "{{ ('export ' ~ item) if item != '' and item.0 != '#' else '' }}" | 35 | line: "{{ ('export ' ~ item) if item != '' and item.0 != '#' else '' }}" |
24 | dest: $HOME/.bashrc_temp | 36 | dest: $XDG_STATE_HOME/bash/bashrc_temp |
25 | insertafter: EOF | 37 | insertafter: EOF |
26 | create: true | 38 | create: true |
27 | state: present | 39 | state: present |
@@ -31,14 +43,3 @@ | |||
31 | when: pam_environment.changed | 43 | when: pam_environment.changed |
32 | debug: | 44 | debug: |
33 | msg: "\u26A0\uFE0F \u26A0\uFE0F You need to log out and back in to update your environment \u26A0\uFE0F \u26A0\uFE0F" | 45 | msg: "\u26A0\uFE0F \u26A0\uFE0F You need to log out and back in to update your environment \u26A0\uFE0F \u26A0\uFE0F" |
34 | - name: Create XDG dirs | ||
35 | file: | ||
36 | path: "{{ item }}" | ||
37 | state: directory | ||
38 | loop: | ||
39 | - "$XDG_CONFIG_HOME" | ||
40 | - "$XDG_STATE_HOME" | ||
41 | - "$XDG_DATA_HOME" | ||
42 | - "$XDG_CACHE_HOME" | ||
43 | - "$HOME/Desktop" | ||
44 | - "$HOME/Downloads" | ||