HPE ProLiant servers have a built-in feature called Intelligent Provisioning that installs all the required drivers for you. If you have registered the server with your HPE support account, you can download all the latest drivers and firmware as a Service Pack for ProLiant.
The Service Pack for ProLiant (SPP) is a comprehensive systems
software and firmware update solution, which is delivered as a single
ISO image. This solution uses Smart Update Manager (SUM) as the
deployment tool and is tested on all HPE ProLiant Gen9 and Gen10
servers as defined in the Service Pack for ProLiant Server Support
Guide.
The service pack image is currently almost 6 GB, because it has drivers, firmware and software for all possible ProLiant combinations, but it has all the automation you need. IMO you shouldn't try and reinvent similar solutions by yourself.