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.
This commit is contained in:
@@ -14,6 +14,6 @@
|
|||||||
|
|
||||||
- name: Add user to docker group
|
- name: Add user to docker group
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
user: "{{ ansible_user_id }}"
|
user: "{{ ansible_facts['user_id'] }}"
|
||||||
groups: docker
|
groups: docker
|
||||||
append: true
|
append: true
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
---
|
---
|
||||||
- name: Clone dot files repo
|
- name: Clone dot files repo
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: https://gitea.learningunix.net/cjr/dotfiles.git
|
repo: git@gitea.learningunix.net:cjr/dotfiles.git
|
||||||
dest: "{{ ansible_user_dir }}/dotfiles"
|
dest: "{{ ansible_facts['user_dir'] }}/dotfiles"
|
||||||
update: true
|
update: true
|
||||||
version: main
|
version: main
|
||||||
|
|
||||||
- name: Clone the nvim repo
|
- name: Clone the nvim repo
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: https://gitea.learningunix.net/cjr/vim.git
|
repo: git@gitea.learningunix.net:cjr/vim.git
|
||||||
dest: "{{ ansible_user_dir }}/nvim"
|
dest: "{{ ansible_facts['user_dir'] }}/nvim"
|
||||||
update: true
|
update: true
|
||||||
version: main
|
version: main
|
||||||
|
|
||||||
- name: Symlink .zshrc
|
- name: Symlink .zshrc
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
src: "{{ ansible_user_dir }}/dotfiles/zsh/.zshrc"
|
src: "{{ ansible_facts['user_dir'] }}/dotfiles/zsh/.zshrc"
|
||||||
dest: "{{ ansible_user_dir }}/.zshrc"
|
dest: "{{ ansible_facts['user_dir'] }}/.zshrc"
|
||||||
state: link
|
state: link
|
||||||
force: true
|
force: true
|
||||||
|
|
||||||
- name: Symlink nvim config
|
- name: Symlink nvim config
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
src: "{{ ansible_user_dir }}/nvim"
|
src: "{{ ansible_facts['user_dir'] }}/nvim"
|
||||||
dest: "{{ ansible_user_dir }}/.config/nvim"
|
dest: "{{ ansible_facts['user_dir'] }}/.config/nvim"
|
||||||
state: link
|
state: link
|
||||||
force: true
|
force: true
|
||||||
|
|||||||
@@ -2,18 +2,18 @@
|
|||||||
- name: Copy cheat sheet desktop file
|
- name: Copy cheat sheet desktop file
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: cheat-sheet.desktop.j2
|
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"
|
mode: "0644"
|
||||||
|
|
||||||
- name: Copy password script
|
- name: Copy password script
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: pass-menu.desktop.j2
|
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"
|
mode: "0644"
|
||||||
|
|
||||||
- name: Set cheat-sheet hotkey
|
- name: Set cheat-sheet hotkey
|
||||||
community.general.ini_file:
|
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"
|
section: "services][net.local.cheat-sheet.sh.desktop"
|
||||||
option: _launch
|
option: _launch
|
||||||
value: Alt+C
|
value: Alt+C
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
- name: Set pass-menu hotkey
|
- name: Set pass-menu hotkey
|
||||||
community.general.ini_file:
|
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"
|
section: "services][net.local.pass-menu.sh.desktop"
|
||||||
option: _launch
|
option: _launch
|
||||||
value: Alt+P
|
value: Alt+P
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Exec={{ ansible_user_dir }}/scripts/cheat-sheet.sh
|
Exec={{ ansible_facts['user_dir'] }}/scripts/cheat-sheet.sh
|
||||||
Name=cheat-sheet
|
Name=cheat-sheet
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
StartupNotify=false
|
StartupNotify=false
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Exec={{ ansible_user_dir }}/scripts/pass-menu.sh
|
Exec={{ ansible_facts['user_dir'] }}/scripts/pass-menu.sh
|
||||||
Name=pass-menu
|
Name=pass-menu
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
StartupNotify=false
|
StartupNotify=false
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
---
|
---
|
||||||
- name: Clone the scripts repo
|
- name: Clone the scripts repo
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: https://gitea.learningunix.net/cjr/scripts
|
repo: git@gitea.learningunix.net:cjr/scripts.git
|
||||||
dest: "{{ ansible_user_dir }}/scripts"
|
dest: "{{ ansible_facts['user_dir'] }}/scripts"
|
||||||
update: true
|
update: true
|
||||||
version: main
|
version: main
|
||||||
|
|
||||||
- name: Ensure that scripts is in the user's path
|
- name: Ensure that scripts is in the user's path
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
path: "{{ ansible_user_dir }}/dotfiles/zsh/.zshrc"
|
path: "{{ ansible_facts['user_dir'] }}/dotfiles/zsh/.zshrc"
|
||||||
line: 'export PATH="$HOME/scripts:$PATH"'
|
line: 'export PATH="$HOME/scripts:$PATH"'
|
||||||
state: present
|
state: present
|
||||||
|
|||||||
@@ -15,6 +15,6 @@
|
|||||||
|
|
||||||
- name: Add user to libvirt group
|
- name: Add user to libvirt group
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
name: "{{ ansible_user_id }}"
|
name: "{{ ansible_facts['user_id'] }}"
|
||||||
groups: libvirt
|
groups: libvirt
|
||||||
append: true
|
append: true
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: Configure CachyOS workstation
|
- name: Configure CachyOS workstation (system)
|
||||||
hosts: cachy
|
hosts: cachy
|
||||||
connection: local
|
connection: local
|
||||||
become: true
|
become: true
|
||||||
@@ -17,6 +17,12 @@
|
|||||||
tags: web
|
tags: web
|
||||||
- role: flatpak
|
- role: flatpak
|
||||||
tags: flatpak
|
tags: flatpak
|
||||||
|
|
||||||
|
- name: Configure CachyOS workstation (user)
|
||||||
|
hosts: cachy
|
||||||
|
connection: local
|
||||||
|
|
||||||
|
roles:
|
||||||
- role: dotfiles
|
- role: dotfiles
|
||||||
tags: dotfiles
|
tags: dotfiles
|
||||||
- role: scripts
|
- role: scripts
|
||||||
|
|||||||
Reference in New Issue
Block a user