Skip to content

Commit

Permalink
change private location
Browse files Browse the repository at this point in the history
  • Loading branch information
fspv committed Sep 29, 2024
1 parent 3a5b4e9 commit 9e866d7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
4 changes: 2 additions & 2 deletions roles/gpg/tasks/configs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: config copy gpg key to file
copy:
dest: "{{ item[0].home }}/.private/{{ item[1].filename }}.gpg"
dest: "{{ item[0].home }}/.local/private/{{ item[1].filename }}.gpg"
content: "{{ item[1]['private_key'] }}"
owner: "{{ item[0].user }}"
mode: '0600'
Expand All @@ -13,7 +13,7 @@
become: true
become_user: "{{ item[0].user }}"
shell: >
gpg --import {{ item[0].home }}/.private/{{ item[1].filename }}.gpg 2>&1
gpg --import {{ item[0].home }}/.local/private/{{ item[1].filename }}.gpg 2>&1
| head -n1
| grep -P '^gpg: key [0-9A-Z]*: (already in secret keyring|secret key imported)$'
when: gpg_private_key_files.changed
Expand Down
28 changes: 24 additions & 4 deletions roles/user/tasks/configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
path: "{{ item.home }}/.ssh/"
state: directory
owner: "{{ item.user }}"
group: "{{ item.user }}"
mode: '0700'
with_items: "{{ users.values() | list }}"

Expand All @@ -37,12 +38,13 @@
path: "{{ item.home }}/venv/"
state: directory
owner: "{{ item.user }}"
group: "{{ item.user }}"
mode: '0777'
with_items: "{{ users.values() | list }}"

- name: config .private dir
file:
path: "{{ item.home }}/.private/"
path: "{{ item.home }}/.local/private/"
state: directory
owner: "{{ item.user }}"
mode: '0700'
Expand Down Expand Up @@ -108,9 +110,27 @@
with_items: "{{ users.values() | list }}"
when: item.user != 'root' and ansible_virtualization_type != 'docker' and ansible_user_id == 'root'

- name: config .cache dir permissions
file:
name: "{{ item.home }}/.cache"
owner: "{{ item.user }}"
group: "{{ item.user }}"
mode: '0700'
state: directory
with_items: "{{ users.values() | list }}"

- name: config .local dir permissions
file:
name: "{{ item.home }}/.local"
owner: "{{ item.user }}"
group: "{{ item.user }}"
mode: '0700'
state: directory
with_items: "{{ users.values() | list }}"

- name: config .private dir for user
file:
name: "{{ item.home }}/.private"
name: "{{ item.home }}/.local/private"
owner: "{{ item.user }}"
mode: '0700'
state: directory
Expand All @@ -120,7 +140,7 @@
- name: config custom secret
template:
src: custom_secret.j2
dest: "{{ item.0.home }}/.private/{{ item.1.filename }}"
dest: "{{ item.0.home }}/.local/private/{{ item.1.filename }}"
owner: "{{ item.0.user }}"
mode: '0600'
with_subelements:
Expand All @@ -131,7 +151,7 @@
- name: config custom secret from file
copy:
src: "{{ item.1.src_dir }}/{{ item.1.filename }}"
dest: "{{ item.0.home }}/.private/{{ item.1.filename }}"
dest: "{{ item.0.home }}/.local/private/{{ item.1.filename }}"
owner: "{{ item.0.user }}"
mode: '0600'
with_subelements:
Expand Down

0 comments on commit 9e866d7

Please sign in to comment.