AhmFM
AhmFM

Reputation: 1782

failed to install dnspython with ansible playbook

Team,

I have my playbook as below and i tried with become: yes as well but no luck. how to get around this ?

      - easy_install:
          name: dnspython
          state: present
        #become: yes

      - name: Validate DNS record lookup for {{ kubeapi_server }}
        debug: msg="{{ lookup('dig', '{{ kubeapi_server }}' )}}"
        vars:
          variable: "{{ lookup('dig', '{{ kubeapi_server }}' )}}"
        failed_when: not variable

Output:

16:18:07  TASK [team-deploy-validation : easy_install] *********************************
16:18:07  [1;30mtask path: /home/testuser/jenkins/workspace/nvdc/run_ansible_playbook/k8s/baremetal/roles/team-deploy-validation/tasks/main.yml:9[0m
16:18:07  Friday 11 October 2019  23:18:07 +0000 (0:00:00.029)       0:00:02.902 ******** 
16:18:07  [0;34mUsing module file /usr/local/lib/python2.7/dist-packages/ansible/modules/packaging/language/easy_install.py[0m
16:18:07  [0;34mPipelining is enabled.[0m
16:18:07  [0;34m<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: testuser[0m
16:18:07  [0;34m<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python && sleep 0'[0m
16:18:07  [0;31mThe full traceback is:[0m
16:18:07  [0;31mWARNING: The below traceback may *not* be related to the actual failure.[0m
16:18:07  [0;31m  File "/teamtmp/ansible_easy_install_payload_x2wopj/ansible_easy_install_payload.zip/ansible/module_utils/basic.py", line 1974, in get_bin_path[0m
16:18:07  [0;31m    bin_path = get_bin_path(arg, required, opt_dirs)[0m
16:18:07  [0;31m  File "/tmp/ansible_easy_install_payload_x2wopj/ansible_easy_install_payload.zip/ansible/module_utils/common/process.py", line 41, in get_bin_path[0m
16:18:07  [0;31m    raise ValueError('Failed to find required executable %s in paths: %s' % (arg, os.pathsep.join(paths)))[0m
16:18:07  [0;31m[0m
16:18:07  [0;31mfatal: [localhost]: FAILED! => {[0m
16:18:07  [0;31m    "changed": false, [0m
16:18:07  [0;31m    "invocation": {[0m
16:18:07  [0;31m        "module_args": {[0m
16:18:07  [0;31m            "executable": "easy_install", [0m
16:18:07  [0;31m            "name": "dnspython", [0m
16:18:07  [0;31m            "state": "present", [0m
16:18:07  [0;31m            "virtualenv": null, [0m
16:18:07  [0;31m            "virtualenv_command": "virtualenv", [0m
16:18:07  [0;31m            "virtualenv_site_packages": false[0m
16:18:07  [0;31m        }[0m
16:18:07  [0;31m    }, [0m
16:18:07  [0;31m    "msg": "Failed to find required executable easy_install in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"[0m
16:18:07  [0;31m}[0m
16:18:07  

Upvotes: 0

Views: 1559

Answers (1)

Shubham Vaishnav
Shubham Vaishnav

Reputation: 1720

Your issue is pretty straight forward.

16:18:07  [0;31m    "msg": "Failed to find required executable easy_install in paths: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"[0m

The log clearly says unable to find easy_install on the host on which you are trying to install dnspython.

You can install easy_install on your remote host by installing python-setuptools.

Just for information, easy_install is a Python module which comes as a part of the Python setuptools, so installing setuptools automatically installs easy_install along with it.

I have added sample tasks(Also suggested by @Matthew) which can help you,

- apt:
    name: python-setuptools
    state: present

- easy_install:
    name: dnspython
    state: present

Upvotes: 2

Related Questions