ansible-pyenv
ansible-pyenv copied to clipboard
"Install versions" fails: "pyenv: No such file or directory"
When trying this role, it fails to install the versions:
TASK: [dirn.pyenv | Install versions] *****************************************
failed: [c.example.com] => (item=2.7.9) => {"cmd": "pyenv install 2.7.9", "failed": true, "item": "2.7.9", "rc": 2}
msg: [Errno 2] No such file or directory
failed: [c.example.com] => (item=3.4.3) => {"cmd": "pyenv install 3.4.3", "failed": true, "item": "3.4.3", "rc": 2}
msg: [Errno 2] No such file or directory
failed: [c.example.com] => (item=pypy-2.5.0) => {"cmd": "pyenv install pypy-2.5.0", "failed": true, "item": "pypy-2.5.0", "rc": 2}
msg: [Errno 2] No such file or directory
failed: [c.example.com] => (item=pypy3-2.4.0) => {"cmd": "pyenv install pypy3-2.4.0", "failed": true, "item": "pypy3-2.4.0", "rc": 2}
msg: [Errno 2] No such file or directory
FATAL: all hosts have already failed -- aborting
The pyenv
command is not available yet: the Add to run commands
task comes
later, and even then, the pyenv_runcom
would need to be sourced before.
I got the same error: TASK: [dirn.pyenv | Install versions] ***************************************** failed: [127.0.0.1] => (item=3.4.3) => {"cmd": "pyenv install 3.4.3", "failed": true, "item": "3.4.3", "rc": 2} msg: [Errno 2] No such file or directory
@dirn Yep, getting the same issue.
@blueyed, @musicformellons, and @oamasood, what OS?
@dirn It's from within an Ubuntu 14.04 Docker container. Here's the dockerfile:
FROM ansible/ubuntu14.04-ansible:stable
MAINTAINER Osman Masood <[email protected]>
WORKDIR /root
ADD . my_dir
RUN ansible-galaxy install dirn.pyenv # Install Ansible role for pyenv from Galaxy
ADD ansible/container-bootstrap.yml /srv/ansible/container-bootstrap.yml
WORKDIR /srv/ansible
RUN ansible-playbook -v container-bootstrap.yml -c local
And my container-bootstrap.yml:
- name: Bootstrap gettalent/base_service_container image
hosts: local
tasks:
- name: update core libs
apt: update_cache=yes
- name: install basic packages
apt: pkg={{ item }} update_cache=yes cache_valid_time=259200 # 3 days
with_items:
- curl
- wget
- build-essential
- gcc
- make
- zlib1g-dev
- libbz2-dev
- libmysqlclient-dev
- libreadline-dev
- libxml2-dev
- libxslt-dev
- libssl-dev
- nginx
- git
- name: install Python and Basic Tools
apt: pkg={{ item }} update_cache=yes cache_valid_time=259200 # 3 days
with_items:
- python
- python-dev
- python-distribute
- python-pip
- python-setuptools
- software-properties-common
- python-software-properties
- name: Install python 2.7.9 in pyenv
hosts: local
roles:
- role: dirn.pyenv
pyenv_virtualenv: false
pyenv_runcom: ~/.bashrc
pyenv_versions:
- 2.7.9
pyenv_default_versions:
- 2.7.9
pyenv_project_versions:
- 2.7.9
Thanks.
Awesome. This will be a huge help.
In install versions command, pyenv should be prefixed with full qualified path:
- name: Install versions
command: creates={{ pyenv_root }}/versions/{{ item }} {{ pyenv_root }}/bin/pyenv install {{ item }}
with_items: "{{ pyenv_versions }}"