From f1dd4fb3c05cd769bbe84abe91ab9373f6a42eea Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Sat, 20 Jun 2026 11:45:05 -0500 Subject: [PATCH] Fix variable deprecations and split site.yml into system and user plays Replace deprecated ansible_user_dir/ansible_user_id with ansible_facts['user_dir'/'user_id'] across all roles. Switch git repo URLs from HTTPS to SSH. Split site.yml into two plays so user-facing roles (dotfiles, scripts, hotkeys) run without become. --- roles/docker/tasks/main.yml | 2 +- roles/dotfiles/tasks/main.yml | 16 ++++++++-------- roles/hotkeys/tasks/main.yml | 8 ++++---- roles/hotkeys/templates/cheat-sheet.desktop.j2 | 2 +- roles/hotkeys/templates/pass-menu.desktop.j2 | 2 +- roles/scripts/tasks/main.yml | 6 +++--- roles/virtualization/tasks/main.yml | 2 +- site.yml | 8 +++++++- 8 files changed, 26 insertions(+), 20 deletions(-) diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index d82f381..aae468d 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -14,6 +14,6 @@ - name: Add user to docker group ansible.builtin.user: - user: "{{ ansible_user_id }}" + user: "{{ ansible_facts['user_id'] }}" groups: docker append: true diff --git a/roles/dotfiles/tasks/main.yml b/roles/dotfiles/tasks/main.yml index b6f0b99..6cc7bcd 100644 --- a/roles/dotfiles/tasks/main.yml +++ b/roles/dotfiles/tasks/main.yml @@ -1,28 +1,28 @@ --- - name: Clone dot files repo ansible.builtin.git: - repo: https://gitea.learningunix.net/cjr/dotfiles.git - dest: "{{ ansible_user_dir }}/dotfiles" + repo: git@gitea.learningunix.net:cjr/dotfiles.git + dest: "{{ ansible_facts['user_dir'] }}/dotfiles" update: true version: main - name: Clone the nvim repo ansible.builtin.git: - repo: https://gitea.learningunix.net/cjr/vim.git - dest: "{{ ansible_user_dir }}/nvim" + repo: git@gitea.learningunix.net:cjr/vim.git + dest: "{{ ansible_facts['user_dir'] }}/nvim" update: true version: main - name: Symlink .zshrc ansible.builtin.file: - src: "{{ ansible_user_dir }}/dotfiles/zsh/.zshrc" - dest: "{{ ansible_user_dir }}/.zshrc" + src: "{{ ansible_facts['user_dir'] }}/dotfiles/zsh/.zshrc" + dest: "{{ ansible_facts['user_dir'] }}/.zshrc" state: link force: true - name: Symlink nvim config ansible.builtin.file: - src: "{{ ansible_user_dir }}/nvim" - dest: "{{ ansible_user_dir }}/.config/nvim" + src: "{{ ansible_facts['user_dir'] }}/nvim" + dest: "{{ ansible_facts['user_dir'] }}/.config/nvim" state: link force: true diff --git a/roles/hotkeys/tasks/main.yml b/roles/hotkeys/tasks/main.yml index 2faa2e9..580ab95 100644 --- a/roles/hotkeys/tasks/main.yml +++ b/roles/hotkeys/tasks/main.yml @@ -2,18 +2,18 @@ - name: Copy cheat sheet desktop file ansible.builtin.template: src: cheat-sheet.desktop.j2 - dest: "{{ ansible_user_dir }}/.local/share/applications/net.local.cheat-sheet.sh.desktop" + dest: "{{ ansible_facts['user_dir'] }}/.local/share/applications/net.local.cheat-sheet.sh.desktop" mode: "0644" - name: Copy password script ansible.builtin.template: src: pass-menu.desktop.j2 - dest: "{{ ansible_user_dir }}/.local/share/applications/net.local.pass-menu.sh.desktop" + dest: "{{ ansible_facts['user_dir'] }}/.local/share/applications/net.local.pass-menu.sh.desktop" mode: "0644" - name: Set cheat-sheet hotkey community.general.ini_file: - path: "{{ ansible_user_dir }}/.config/kglobalshortcutsrc" + path: "{{ ansible_facts['user_dir'] }}/.config/kglobalshortcutsrc" section: "services][net.local.cheat-sheet.sh.desktop" option: _launch value: Alt+C @@ -21,7 +21,7 @@ - name: Set pass-menu hotkey community.general.ini_file: - path: "{{ ansible_user_dir }}/.config/kglobalshortcutsrc" + path: "{{ ansible_facts['user_dir'] }}/.config/kglobalshortcutsrc" section: "services][net.local.pass-menu.sh.desktop" option: _launch value: Alt+P diff --git a/roles/hotkeys/templates/cheat-sheet.desktop.j2 b/roles/hotkeys/templates/cheat-sheet.desktop.j2 index 7e8d449..866657d 100644 --- a/roles/hotkeys/templates/cheat-sheet.desktop.j2 +++ b/roles/hotkeys/templates/cheat-sheet.desktop.j2 @@ -1,5 +1,5 @@ [Desktop Entry] -Exec={{ ansible_user_dir }}/scripts/cheat-sheet.sh +Exec={{ ansible_facts['user_dir'] }}/scripts/cheat-sheet.sh Name=cheat-sheet NoDisplay=true StartupNotify=false diff --git a/roles/hotkeys/templates/pass-menu.desktop.j2 b/roles/hotkeys/templates/pass-menu.desktop.j2 index 9851870..ae75379 100644 --- a/roles/hotkeys/templates/pass-menu.desktop.j2 +++ b/roles/hotkeys/templates/pass-menu.desktop.j2 @@ -1,5 +1,5 @@ [Desktop Entry] -Exec={{ ansible_user_dir }}/scripts/pass-menu.sh +Exec={{ ansible_facts['user_dir'] }}/scripts/pass-menu.sh Name=pass-menu NoDisplay=true StartupNotify=false diff --git a/roles/scripts/tasks/main.yml b/roles/scripts/tasks/main.yml index eb2ecca..4be60bf 100644 --- a/roles/scripts/tasks/main.yml +++ b/roles/scripts/tasks/main.yml @@ -1,13 +1,13 @@ --- - name: Clone the scripts repo ansible.builtin.git: - repo: https://gitea.learningunix.net/cjr/scripts - dest: "{{ ansible_user_dir }}/scripts" + repo: git@gitea.learningunix.net:cjr/scripts.git + dest: "{{ ansible_facts['user_dir'] }}/scripts" update: true version: main - name: Ensure that scripts is in the user's path ansible.builtin.lineinfile: - path: "{{ ansible_user_dir }}/dotfiles/zsh/.zshrc" + path: "{{ ansible_facts['user_dir'] }}/dotfiles/zsh/.zshrc" line: 'export PATH="$HOME/scripts:$PATH"' state: present diff --git a/roles/virtualization/tasks/main.yml b/roles/virtualization/tasks/main.yml index 5943c05..11902d5 100644 --- a/roles/virtualization/tasks/main.yml +++ b/roles/virtualization/tasks/main.yml @@ -15,6 +15,6 @@ - name: Add user to libvirt group ansible.builtin.user: - name: "{{ ansible_user_id }}" + name: "{{ ansible_facts['user_id'] }}" groups: libvirt append: true diff --git a/site.yml b/site.yml index 0bd7e70..2533c06 100644 --- a/site.yml +++ b/site.yml @@ -1,5 +1,5 @@ --- -- name: Configure CachyOS workstation +- name: Configure CachyOS workstation (system) hosts: cachy connection: local become: true @@ -17,6 +17,12 @@ tags: web - role: flatpak tags: flatpak + +- name: Configure CachyOS workstation (user) + hosts: cachy + connection: local + + roles: - role: dotfiles tags: dotfiles - role: scripts