---
- name: Ensure need packages for xorg is installed
  include_role:
    name: package-group
  vars:
    package_group: xorg

- name: Setup keyboard
  become: yes
  copy:
    src: etc/X11/xorg.conf.d/20-keyboard.conf
    dest: /etc/X11/xorg.conf.d/20-keyboard.conf
    owner: root
    group: root
    mode: 0644
  tags:
    - xorg

- name: Install Intel video driver
  become: yes
  pacman:
    name: ["xf86-video-intel", "libva-intel-driver", "libva-vdpau-driver", "libvdpau-va-gl"]
    update_cache: yes
    state: latest
  when:
    - ansible_local.hardware.vga_vendor == "Intel Corporation"
  tags:
    - xorg

- name: Install Nvidia video driver
  become: yes
  pacman:
    name: ["nvidia-dkms", "libvdpau", "nvidia-settings", "nvidia-utils"]
    update_cache: yes
    state: latest
  when:
    - ansible_local.hardware.vga_vendor == "NVIDIA Corporation"
  tags:
    - xorg

---
- name: Ensure need packages for xorg is installed
  include_role:
    name: package-group
  vars:
    package_group: xorg

- name: Setup keyboard
  become: yes
  copy:
    src: etc/X11/xorg.conf.d/20-keyboard.conf
    dest: /etc/X11/xorg.conf.d/20-keyboard.conf
    owner: root
    group: root
    mode: 0644
  tags:
    - xorg

- name: Install Intel video driver
  become: yes
  pacman:
    name: "{{ packages }}"
    state: latest
  vars:
    packages:
      - xf86-video-intel
      - libva-intel-driver
      - libva-vdpau-driver
      - libvdpau-va-gl
  when:
    - ansible_local.hardware.vga_vendor == "Intel Corporation"
  tags:
    - xorg

- name: Install Nvidia video driver
  become: yes
  pacman:
    name: "{{ packages }}"
    state: latest
  vars:
    packages:
      - nvidia-dkms
      - libvdpau
      - nvidia-settings
      - nvidia-utils
  when:
    - ansible_local.hardware.vga_vendor == "NVIDIA Corporation"
  tags:
    - xorg

- name: Install AMD video driver
  become: yes
  pacman:
    name: "{{ packages }}"
    state: latest
  vars:
    packages:
      - xf86-video-amdgpu
      - libva-mesa-driver
      - mesa-vdpau
      - vulkan-icd-loader
      - vulkan-radeon
      - lib32-libva-mesa-driver
      - lib32-mesa-vdpau
      - lib32-vulkan-icd-loader
      - lib32-vulkan-radeon
  when:
    - ansible_local.hardware.vga_vendor == "Advanced Micro Devices, Inc. [AMD/ATI]"
  tags:
    - xorg

Add support for AMD, cleanup, fix idempotency
Add support for AMD, cleanup, fix idempotency
