Use ansible to build/install kernel module

Hi. I’m new to the ansible world, so forgive the noob question. I need to do some post install configuration of a set of Ubuntu bionic devices and one of these things includes installing a custom kernel module from a git repo. A co-worker suggested ansible, and copying some files to /etc seems simply enough, so my question is how easy is it to use ansible to build and install the kernel module? If there’s an example to look at, I’ll happily do so. My basic work flow is this:

  • clone git repo
  • edit Makefile
  • make dkms_install

Thanks!

FWIW, see the links below
https://ansible-linux-postinstall.readthedocs.io/en/latest/qsg.html

... set of Ubuntu bionic devices

https://github.com/vbotka/ansible-linux-postinstall/blob/master/tasks/udev.yml

... installing a custom kernel module from a git
repo.

https://github.com/vbotka/ansible-linux-postinstall/blob/master/tasks/modules.yml