If you just started getting these, upgrade your target system packages.

FAILED! => {"changed": false, "msg": "failed to fetch key at https://rpms.remirepo.net/RPM-GPG-KEY-remi2018 , error was: Request failed: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)>"}

Personally I was only installing security and bugfixes like

- name: Upgrade packages
yum: name: '*' state: latest security: yes bugfix: yes

Once I run yum update to install all packages, including an update to ‘ca-certificates.noarch 0:2021.2.50–72.el7_9’ everything is working again.

Before:

pythonPython 2.7.5 (default, Aug  7 2019, 00:51:29)[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import requestsr>>> r = requests.get('https://rpms.remirepo.net/')Traceback (most recent call last):File "<stdin>", line 1, in <module>File "/usr/lib/python2.7/site-packages/requests/api.py", line 68, in getreturn request('get', url, **kwargs)File "/usr/lib/python2.7/site-packages/requests/api.py", line 50, in requestresponse = session.request(method=method, url=url, **kwargs)File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 486, in requestresp = self.send(prep, **send_kwargs)File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 598, in sendr = adapter.send(request, **kwargs)File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 431, in sendraise SSLError(e, request=request)requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)

After

pythonPython 2.7.5 (default, Nov 16 2020, 22:23:17)[GCC 4.8.5 20150623 (Red Hat 4.8.5–44)] on linux2Type “help”, “copyright”, “credits” or “license” for more information.>>> import requestsr>>> r = requests.get(‘https://rpms.remirepo.net/')>>>KeyboardInterrupt>>>