Call the Ansible script from Vagrant and
I would like to build Python using pyenv and eventually implement a script to install Django.
Using the script below,
-name —Install the specified version of Python
shell:bash-lc "pyenv install {{python_version}}}"
become —false
- name —Reflects the specified version in the working directory
shell:bash-lc "pyenv local {{python_version}}}"
args:
chdir: "{work_dir}}"
become —false
- name —Pip upgrade
shell:bash-lc "pip install --upgrade pip"
args:
chdir: "{work_dir}}"
become —false
- name —install django
pip:
name —django
chdir: "{work_dir}}"
version: "{{django_version}}"
executable:pipe
become —false
I received the following error.You said you don't have a pip module, but
When I logged in to the guest OS with vagrantssh, the pip command was found successfully.
Is it possible to build python from pyenv and call the pip under its influence from Ansible?
I would appreciate it if you could let me know.
TASK [django:install django] ****************************************************
fatal: [127.0.0.1]: FAILED!=> { "changed": false, "failed": true, "msg": "Unable to find any of pip to use.pipe needs to be installed."}
to retry, use: --limit@/vagrant/playbooks/main.retry
I solved myself.
Ansible uses the default Python (/usr/bin/python), so
You will need to modify the Python interpreter using the following modules:
set_fact:ansable_python_interpreter=/home/{{work_user}}/.pyenv/shims/python
611 GDB gets version error when attempting to debug with the Presense SDK (IDE)
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
578 Understanding How to Configure Google API Key
914 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.