Ansible Playbook to disable Wayland for GDM3

---
- name: Disable Wayland in GDM3
  hosts: all
  become: true
  tasks:
    - name: Ensure WaylandEnable=false in GDM3 config
      lineinfile:
        path: /etc/gdm3/custom.conf
        regexp: '^#?WaylandEnable='
        line: 'WaylandEnable=false'
        backup: yes
      notify: restart gdm3

  handlers:
    - name: restart gdm3
      service:
        name: gdm3
        state: restarted