Issue with Ruby version on target system

I have a role that will install Redmine onto a RHEL 8 system. When I run the playbook and it tries to install “bundler”, I get the following error:

ERROR: Error installing bundler:
bundler requires Ruby version >= 2.6.0. The current ruby version is 2.5.0.

I have installed Ruby 2.7.8 on the target system using rvm, but I still get that error. How can I have the playbook recognize that Ruby 2.7.8 is installed and the default to eliminate this error?

Thanks,
Harry

Without seeing any tasks or plays that would be hard.

Here’s the section of the role:

  • name: Install latest Bundler gem
    ansible.builtin.gem:
    name: bundler
    state: present
    user_install: false
    executable: /bin/gem
    changed_when: false

Thanks,
Harry

Being somewhat familiar with rvm, has the gem binary been (sym)linked to the version of ruby deployed with rvm? Alternatively, you can probably set the executable attribute to point to an explicit path of the gem binary (as opposed to defaulting to /bin/gem)