Send SMS using Twilio in ansible , getting below error

i have tried using the twilo still not able to get the output -

  • hosts: localhost
    tasks:
  • name: Send notification message via twilio
    twilio:
    msg: ‘Hello from Nishant via Ansible’
    account_sid: ACxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxx
    auth_token: a0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    from_number: +918793127307
    to_number: +919168612880
    delegate_to: localhost

below is the error-

fatal: [localhost → localhost]: FAILED! => {“changed”: false, “failed”: true, “msg”: “Failed to validate the SSL certificate for api.twilio.com:443. Make sure your managed systems have a valid CA certificate installed. If the website serving the url uses SNI you need python >= 2.7.9 on your managed machine or you can install the urllib3, pyopenssl, ndg-httpsclient, and pyasn1 python modules to perform SNI verification in python >= 2.6. 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”}.

Can someone please share the working playbook for the same for reference.

Looks like you either need to use a more recent version of python. Perhaps you can delegate the module to run on a newer linux distribution if you can’t upgrade your ansible controller machine.