Ok so I installed virtualenv and found where my python path was… I believe this should work: /usr/local/Cellar/python@2/2.7.15_1/bin
I ran export command and then trellis init and then trellis deploy and had the same issues. I then deleted the .trellis folder and ran trellis init again and trellis deploy… and same issues.
I then realized I still hadn’t upgraded trellis-cli yet! So I got v0.6.1 and removed the .trellis folder and ran trellis init and received an error:
[ **----** @------MBP: **~/Documents/projects/-----/websites/------.com/trellis** **(staging)** ] $ trellis init
Creating virtualenv in /Users/-----/Documents/projects/------/websites/-------.com/trellis/.trellis/virtualenv
Error creating virtualenv: exit status 3
an empty .trellis folder is created but nothing in it.
edit: the trellis init command works fine if I uninstall virtualenv… when I reinstall and run trellis init again… i get the error.
Does virtualenv work fine if you run it manually? Oh if you literally used the value /usr/local/Cellar/python@2/2.7.15_1/bin then that’s probably the problem. You also need the binary itself:
I made sure I had the newest ansible on my system and ran a deploy on old site and it did not work.
I then ran ‘export VIRTUALENV_PYTHON=/usr/local/bin/python’ and trellis init and no issues. I then ran ‘trellis exec ansible --version’ and got the older version of trellis I put in requirements.txt… AWESOME!
Then I ran ‘trellis deploy staging site.com’ and got the response and error:
Running command => ./bin/deploy.sh staging site.com
PLAY [Ensure necessary variables are defined] **********************************
[WARNING]: You Ansible version is 2.7.5 but this version of Trellis has only
been tested for compatability with Ansible 2.4.0.0 -> 2.4.3.0. It is advisable
to check for Trellis updates or downgrade your Ansible version.
TASK [Ensure environment is defined] *******************************************
skipping: [localhost]
PLAY [Test Connection] *********************************************************
TASK [connection : Require manual definition of remote-user] *******************
skipping: [xxx.xxx.124.81]
TASK [connection : Specify preferred HostKeyAlgorithms for unknown hosts] ******
/bin/sh: grep: command not found
System info:
Ansible 2.7.5; Darwin
Trellis at "Support git url format `ssh://user@host/path/to/repo`"
---------------------------------------------------
An unhandled exception occurred while templating '{{ openssh_6_5_plus |
ternary('ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-
ed25519,ssh-rsa', 'ssh-rsa-cert-v01@openssh.com,ssh-rsa') }}'. Error was a
<class 'ansible.errors.AnsibleError'>, original message: An unhandled
exception occurred while templating '{{ (lookup('pipe', 'ssh -V 2>&1')) |
regex_replace('(.*OpenSSH_([\d\.]*).*)', '\2') | version_compare('6.5', '>=')
}}'. Error was a <class 'ansible.errors.AnsibleError'>, original message: An
unhandled exception occurred while running the lookup plugin 'pipe'. Error
was a <class 'ansible.errors.AnsibleError'>, original message:
lookup_plugin.pipe(ssh -V 2>&1) returned 127
fatal: [xxx.xxx.124.81]: FAILED! => {}
to retry, use: --limit @/Users/------/Documents/projects/-------/websites/trellis/deploy.retry
PLAY RECAP *********************************************************************
xxx.xxx.124.81 : ok=0 changed=0 unreachable=0 failed=1
localhost : ok=0 changed=0 unreachable=0 failed=0
2019/10/07 10:39:10 exit status 2
So I tried to activate the virtualenv myself by going into /trellis/.trellis/virtualenv and running ‘source bin/activate’ And it was working because it said (virtualenv) in front of my bash location line or whatever it’s called.
I ran ansible --version and got the correct one I needed and then cd …/…/ back into my trellis folder and ran: ‘ansible-playbook deploy.yml -e “site=site.com env=staging”’
This worked fine with no errors!
So it seems like trellis deploy is having some sort of ssh issue while ansible deploy after activated virtualenv is not having that issue.
Upgrading to 0.6.2 worked. SO it was the PATH issue.
Thank you so much for working with me on this!
So using requirements.txt and trellis-cli seems like a great and easy option to use sites that use older versions of trellis and newer sites on the same system.