---
- name: Install initramfs-tools, Plymouth, and themes
  apt:
    name:
      - plymouth
      - plymouth-themes
    state: present
    update_cache: yes

- name: Ensure plymouth is included in initramfs
  lineinfile:
    path: /etc/initramfs-tools/modules
    line: "plymouth"
    state: present

- name: Configure GRUB to use splash screen
  lineinfile:
    path: /etc/default/grub
    regexp: '^GRUB_CMDLINE_LINUX_DEFAULT='
    line: 'GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"'
    state: present
  notify: Update GRUB

- name: Copy theme to plymouth theme dir
  copy:
    src: abstract_ring_alt/
    dest: /usr/share/plymouth/themes/abstract_ring_alt/
    owner: root
    group: root
    mode: '0755'

- name: Configure update-alternatives for Plymouth
  command: >
    update-alternatives --install /usr/share/plymouth/themes/default.plymouth default-plymouth /usr/share/plymouth/themes/abstract_ring_alt/abstract_ring_alt.plymouth 100
  notify: Regenerate Initramfs

- name: Set Plymouth theme
  command: >
    update-alternatives --set default-plymouth /usr/share/plymouth/themes/abstract_ring_alt/abstract_ring_alt.plymouth
  notify: Regenerate Initramfs
