properly select the highest connected GPU

This commit is contained in:
Josh Lay 2022-11-03 20:09:52 -05:00
parent 70e756e01a
commit 471e055ca5
Signed by: jlay
GPG key ID: B265E45CACAD108A
2 changed files with 2 additions and 2 deletions

View file

@ -42,7 +42,7 @@
when: (fed_ppdtuned_swap is not defined) or ('tuned' not in ansible_facts.packages) when: (fed_ppdtuned_swap is not defined) or ('tuned' not in ansible_facts.packages)
- name: determine GPU device in drm subsystem - name: determine GPU device in drm subsystem
shell: shell:
cmd: grep -ls ^connected /sys/class/drm/*/status | grep -o card[0-9] | sort | uniq | tail -1 cmd: grep -ls ^connected /sys/class/drm/*/status | grep -o card[0-9] | sort | uniq | sort -h | tail -1
executable: /bin/bash executable: /bin/bash
changed_when: false changed_when: false
register: card register: card

View file

@ -16,7 +16,7 @@
{# done this way to avoid issues with the card number possibly shifting after playbook run #} {# done this way to avoid issues with the card number possibly shifting after playbook run #}
# dynamically determine the connected GPU using the DRM subsystem # dynamically determine the connected GPU using the DRM subsystem
CARD=$(/usr/bin/grep -ls ^connected /sys/class/drm/*/status | /usr/bin/grep -o 'card[0-9]' | /usr/bin/sort | /usr/bin/uniq | /usr/bin/tail -1) CARD=$(/usr/bin/grep -ls ^connected /sys/class/drm/*/status | /usr/bin/grep -o 'card[0-9]' | /usr/bin/sort | /usr/bin/uniq | /usr/bin/sort -h | /usr/bin/tail -1)
{# begin the templated script for 'default' profiles to reset state #} {# begin the templated script for 'default' profiles to reset state #}
{% if 'default' in item.0.key %} {% if 'default' in item.0.key %}