From 1593a2fd28b4771aabe872ffec05ee23f025634f Mon Sep 17 00:00:00 2001 From: Adam Tetelman Date: Thu, 10 Jun 2021 10:39:00 -0700 Subject: [PATCH] split rhel7/rhel8 install_driver register to avoid overwriting the value when skipped --- tasks/install-redhat.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tasks/install-redhat.yml b/tasks/install-redhat.yml index 4808f62..6df75be 100644 --- a/tasks/install-redhat.yml +++ b/tasks/install-redhat.yml @@ -52,7 +52,7 @@ name: "{{ nvidia_driver_package_version | ternary('nvidia-driver-latest-dkms-'+nvidia_driver_package_version, 'nvidia-driver-latest-dkms') }}" state: "{{ nvidia_driver_package_state }}" autoremove: "{{ nvidia_driver_package_state == 'absent' }}" - register: install_driver + register: install_driver_rhel7 environment: "{{proxy_env if proxy_env is defined else {}}}" when: ansible_distribution_major_version < '8' @@ -61,6 +61,13 @@ name: "{{ nvidia_driver_package_version | ternary('@nvidia-driver:'+nvidia_driver_package_version, '@nvidia-driver:latest-dkms') }}" state: "{{ nvidia_driver_package_state }}" autoremove: "{{ nvidia_driver_package_state == 'absent' }}" - register: install_driver + register: install_driver_rhel8 environment: "{{proxy_env if proxy_env is defined else {}}}" when: ansible_distribution_major_version > '7' + +- name: Set install_driver.changed var for RHEL 7/8 + debug: + msg: Driver installed for RHEL + when: install_driver_rhel7.changed or install_driver_rhel8.changed + register: install_driver + changed_when: install_driver_rhel7.changed or install_driver_rhel8.changed