download elasticsearch error during Open edX installation

Bumped to this error a couple of times during my install of open edX on Microsoft Azure (check out the step-by-step here).

TASK: [elasticsearch | download elasticsearch] ******************************** failed: [localhost] => {“failed”: true, “item”: “”}
msg: Failed to validate the SSL certificate for download.elasticsearch.org:443. Use validate_certs=no or make sure your managed systems have a valid CA certificate installed. 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
FATAL: all hosts have already failed — aborting

Seems like quite a few folks had it as well. One way to fix it is to set validate_certs to no in the configuration/playbooks/roles/elasticsearch/tasks/main.yml file. While I can see that the PR has been merged, I do not understand why this error still occur to me even after deleting the configuration and cloning the configuration manually.

sudo rm -rf /var/tmp/configuration
cd /var/tmp
git clone -b release https://github.com/edx/configuration
cd /var/tmp/configuration
sudo pip install -r requirements.txt
cd /var/tmp/configuration/playbooks && sudo ansible-playbook -c local ./edx_sandbox.yml -i "localhost,"

In any case, I found that my copy of configuration/playbooks/roles/elasticsearch/tasks/main.yml still does not have validate_certs=no. In order to fix that, we need to edit the file in the server.

Here are some useful commands to edit a file:

  1. For editing
    vi main.yml
    
  2. For inserting
    Press i //Do required editing
    
  3. For exiting
    Press Esc
      :wq //for exiting and saving
      :q! //for exiting without saving

So, to solve our issue:

  1. Run the following code
    cd /var/tmp/configuration/playbooks/roles/elasticsearch/tasks
    vi main.yml
  2. Go to line 37, right after force=no, and press i to insert.
  3. Type validate_certs=no in a new line.
    elasticsearch1
  4. Press Esc and type :wq.
  5. Run the following command to install open edX again.
    cd /var/tmp/configuration/playbooks && sudo ansible-playbook -c local ./edx_sandbox.yml -i "localhost,"
  6. The download elasticsearch task should not throw an error now 🙂