0
votes

I'm trying to Setup webtatic yum source for php-fpm in ansible playbook.

My code is:

- name: Setup webtatic yum source for php-fpm
  yum: name=https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

It fails with the error:

fatal: [test.example.com]: FAILED! => {"changed": false, "msg": "**Failed to validate the SSL certificate for mirror.webtatic.com:443. Make sure your managed systems have a valid CA certificate installed. You can use validate_certs=False if you do not need to confirm the servers identity but this is unsafe and not recommended.** Paths checked for this platform: /etc/ssl/certs, /etc/pki/ca-trust/extracted/pem, /etc/pki/tls/certs, /usr/share/ca-certificates/cacert.org, /etc/ansible. The exception msg was: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:618)."}

How can I write it correctly?

2

2 Answers

2
votes

This tends to happen when your managed node does not have the CA root certificate bundle installed.

A possible fix would be to verify it is present before trying to install your rpm:

- name: Setup webtatic yum source for php-fpm
  yum:
    name: "{{ packages }}"
  vars:
    packages:
    - ca-certificates # This package contains the required CA root certificate bundle 
    - https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
1
votes

The problem root might be in your local time if it is not synchronized correctly.

I assume that you have ca-certificates package already installed.

The CA certificate issues are sometimes related to the incorrect time.

openssl s_client -host mirror.webtatic.com -port 443 \
    -CAfile /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt

Look for Verify return code: 9 (certificate is not yet valid) or notBefore=...

Please, try to install the ntp and ntpdate packages, then synchronize your time. There is an example for CentOS how to do it: https://thebackroomtech.com/2019/01/17/configure-centos-to-sync-with-ntp-time-servers/

This should fix your problem if it was due to unsynchronized time.