Automatically keep only x numbers of kernels on update

Hi,
i wonder if it's possible to configure urpm or rpm to keep only x numbers of kernels on updates like in CentOS according to this article:
https://www.tecmint.com/delete-old-kernels-in-centos-rhel-and-fedora/
Thanks for any hints!
i wonder if it's possible to configure urpm or rpm to keep only x numbers of kernels on updates like in CentOS according to this article:
https://www.tecmint.com/delete-old-kernels-in-centos-rhel-and-fedora/
Thanks for any hints!