Files
fedora-provisioning-ansible/tasks/user_config.yml
T
2026-06-30 10:58:19 +01:00

73 lines
2.0 KiB
YAML

---
- name: Ensure XDG config and wanted user directories exist
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
owner: "{{ user_name }}"
mode: "{{ item.mode }}"
loop:
- { path: "{{ user_home }}/.config", mode: "0755" }
- { path: "{{ user_home }}/Downloads", mode: "0755" }
- { path: "{{ user_home }}/Pictures", mode: "0755" }
become: false
- name: Disable automatic XDG user directory creation
ansible.builtin.copy:
dest: "{{ user_home }}/.config/user-dirs.conf"
owner: "{{ user_name }}"
mode: "0644"
content: |
enabled=False
become: false
- name: Keep only Downloads and Pictures as real XDG user directories
ansible.builtin.copy:
dest: "{{ user_home }}/.config/user-dirs.dirs"
owner: "{{ user_name }}"
mode: "0644"
content: |
XDG_DESKTOP_DIR="$HOME"
XDG_DOCUMENTS_DIR="$HOME"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_MUSIC_DIR="$HOME"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_PUBLICSHARE_DIR="$HOME"
XDG_TEMPLATES_DIR="$HOME"
XDG_VIDEOS_DIR="$HOME"
become: false
- name: Remove unwanted empty XDG directories
ansible.builtin.file:
path: "{{ user_home }}/{{ item }}"
state: absent
loop:
- Desktop
- Documents
- Music
- Public
- Templates
- Videos
become: false
- name: Check for the Git signing public key
ansible.builtin.stat:
path: "{{ git_signing_key }}"
become: false
register: git_signing_public_key
- name: Read the Git signing public key
ansible.builtin.slurp:
src: "{{ git_signing_key }}"
become: false
register: git_signing_public_key_contents
when: git_signing_public_key.stat.exists
- name: Configure allowed SSH signers
ansible.builtin.copy:
dest: "{{ user_home }}/.ssh/allowed_signers"
owner: "{{ user_name }}"
mode: "0644"
content: "{{ git_email }} {{ git_signing_public_key_contents.content | b64decode | trim }}\n"
become: false
when: git_signing_public_key.stat.exists