---

- name: Install required packages
  apt:
    state: present
    name:
      - plymouth # Bootup Splash
      - plymouth-themes # Bootup Splash Theme

- name: Configure GRUB
  template:
    src: default_grub.txt
    dest: /etc/default/grub
    owner: root
    group: root
    mode: u=rw,g=r,o=r
  notify:
    - update-grub

- name: Download plymouth theme
  unarchive:
    src: "{{ plymouth_theme_url }}"
    dest: "{{ global_plymouth_themes_directory }}"
    remote_src: yes
    owner: root
    group: root
    mode: u=rwX,g=rX,o=rX
    creates: "{{ global_plymouth_themes_directory }}/{{ plymouth_theme }}"
  when: plymouth_theme_pack != 'internal'

- name: Configure Plymouth
  template:
    src: plymouthd.conf
    dest: /etc/plymouth/plymouthd.conf
    owner: root
    group: root
    mode: u=rw,g=r,o=r
  notify:
    - rebuild initrd
