diff options
| author | Ahmed Abdelhalim <[email protected]> | 2026-03-01 23:48:05 +0100 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2026-03-01 23:48:05 +0100 |
| commit | cf2321a1ce41e421cba4e12b73c09c2a12fe61d0 (patch) | |
| tree | c9abcaafd9160b88418db434ac6622fb81b8b365 /roles/gpu_driver | |
| parent | a6049265a981107bd042701ca2097410a6eef682 (diff) | |
Refactor graphics driver roles
Now with the gpu_driver, the installing of the correct driver is
delegated to this role, which orchestrate the installing of one or more
drivers.
This refactoring of the role/testing, means that the roles don't run on
testing (intentionally), if a driver needs to be tested it will be added
but for now it's not really all that beneficial to keep this 30+ minutes
testing roles running just to test the packages existence.
It also simplifies the roles, and added as a dependency for steam which
is the main reason why these are needed to be installed (also better
hyprland animations, but that's not as crucial as steam failing without
the drivers).
Diffstat (limited to 'roles/gpu_driver')
| -rw-r--r-- | roles/gpu_driver/meta/argument_specs.yml | 8 | ||||
| -rw-r--r-- | roles/gpu_driver/meta/main.yml | 12 | ||||
| -rw-r--r-- | roles/gpu_driver/tasks/main.yml | 12 | ||||
| -rw-r--r-- | roles/gpu_driver/vars/main.yml | 6 |
4 files changed, 38 insertions, 0 deletions
diff --git a/roles/gpu_driver/meta/argument_specs.yml b/roles/gpu_driver/meta/argument_specs.yml new file mode 100644 index 00000000..6986388f --- /dev/null +++ b/roles/gpu_driver/meta/argument_specs.yml @@ -0,0 +1,8 @@ +--- +argument_specs: + main: + short_description: "Detect the GPU and include the appropriate driver role" + description: > + Detects the GPU present on the machine using PCI device information and + includes the matching driver role (intel_i915 or nvidia_gtx1060). + options: {} diff --git a/roles/gpu_driver/meta/main.yml b/roles/gpu_driver/meta/main.yml new file mode 100644 index 00000000..4b4c9a4e --- /dev/null +++ b/roles/gpu_driver/meta/main.yml @@ -0,0 +1,12 @@ +--- +dependencies: + - role: "pciutils" +galaxy_info: + author: "a14m" + description: "Detect the GPU and include the appropriate driver role" + license: "MIT" + min_ansible_version: "2.18" + platforms: + - name: "ArchLinux" + versions: + - "all" diff --git a/roles/gpu_driver/tasks/main.yml b/roles/gpu_driver/tasks/main.yml new file mode 100644 index 00000000..7f6f130f --- /dev/null +++ b/roles/gpu_driver/tasks/main.yml @@ -0,0 +1,12 @@ +--- +- name: "Detect GPU" + ansible.builtin.command: + cmd: "lspci" + register: gpu_driver_lspci + changed_when: false + +- name: "Include driver role for matched GPU" + ansible.builtin.include_role: + name: "{{ item.role }}" + loop: "{{ gpu_driver_map }}" + when: item.match in gpu_driver_lspci.stdout diff --git a/roles/gpu_driver/vars/main.yml b/roles/gpu_driver/vars/main.yml new file mode 100644 index 00000000..152f7499 --- /dev/null +++ b/roles/gpu_driver/vars/main.yml @@ -0,0 +1,6 @@ +--- +gpu_driver_map: + - match: "GeForce GTX 1060" + role: "nvidia_gtx1060" + - match: "Intel" + role: "intel_i915" |
