githubsslansiblessl-certificaterepo

SSL Certificate error when create GitHub repo with Ansible Module


I'm using the github_repo ansible module to accessing our entreprise github repository.

As test I've created a personal access token to access it. Unfortunately I received an SSLError despite that http.sslverify: false is configured in git. Here's the error:

"msg": "Unexpected error. SSLError(MaxRetryError(\"HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /user (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:897)'),))\",),)"

As anyone an idea how to resolve this? does anyone experience with ansible and github? Thanks in advance for your help


Solution

  • You're not using git; you're using the GitHub REST API. Your git configuration settings are not relevant.

    You need to install your enterprise CA certificate somewhere that the Python requests module can find it (this module is ultimately used by the github_repo module to make http requests).

    It looks like the simplest method is to put the CA certificate in a file and then set the REQUESTS_CA_BUNDLE environment variable to point to the location of this file.

    There doesn't appear to be a way to disable SSL verification via an environment variable (there is some discussion on this topic in issue #6071).