---

- name: ROOT | dotfiles presence
  become: no
  ansible.builtin.copy:
    src: "{{ item }}"
    dest: "/root/.{{ item | basename }}"
    mode: 0640
    owner: root
    group: root
  with_fileglob:
    ../user_cfg/files/dotfiles/*
  loop_control:
    label: "{{ item | basename }}"

- name: ROOT | ZSH files absence
  become: no
  ansible.builtin.file:
    path: "/etc/zsh/zlogin"
    state: absent

- name: ROOT | Set ZSH for shell
  become: no
  ansible.builtin.user:
    name: root
    shell: /bin/zsh
    state: present

- name: ROOT | TEMP-FIX font dir absence
  become: no
  ansible.builtin.file:
    path: "/usr/local/share/fonts/fonts/"
    state: absent

- name: ROOT | JetBrainsMono presence
  become: no
  ansible.builtin.find:
    path: "/usr/local/share/fonts/"
    patterns: "JetBrainsMono*"
    recurse: yes
  register: font_presence

- name: ROOT | install JetBrainsMono font
  become: no
  when: font_presence.matched < 50
  ansible.builtin.unarchive:
    dest: "/usr/local/share/"
    remote_src: yes
    src: https://download.jetbrains.com/fonts/JetBrainsMono-2.242.zip
