I’m excited to try out the new github-oauth composer authentication support in the latest Trellis version!
I just upgraded my trellis project to the latest version 1.19.0, re-init the project with destroying my local box and running trellis init
.
Locally everything is working fine again, however when I try to re-provision my remote server I get the following error during the letsencrypt : Test Acme Challenges task:
TASK [letsencrypt : Test Acme Challenges] **************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: No module named http.client
failed: [159.65.192.172] (item=example.com) => {...}, "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 102, in <module>\n File \"<stdin>\", line 94, in _ansiballz_main\n File \"<stdin>\", line 40, in invoke_module\n File \"/usr/lib/python2.7/runpy.py\", line 188, in run_module\n fname, loader, pkg_name)\n File \"/usr/lib/python2.7/runpy.py\", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File \"/usr/lib/python2.7/runpy.py\", line 72, in _run_code\n exec code in run_globals\n File \"/tmp/ansible_test_challenges_payload_N_vGBn/ansible_test_challenges_payload.zip/ansible/modules/test_challenges.py\", line 5, in <module>\nImportError: No module named http.client\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
...ignoring
TASK [letsencrypt : Notify of challenge failures] ******************************
fatal: [159.65.192.172]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'failed_hosts'\n\nThe error appears to be in '/Users/username/path/to/project/trellis/roles/letsencrypt/tasks/nginx.yml': line 65, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Notify of challenge failures\n ^ here\n"}
The error No module named http.client
is caused since the test_challenges seems to be using python 2.7 while http.client
was added in python 3?
I have no reference to any python 2.7 instance?
With pyenv I have set python 3.9.14 as my global version.
When I run trellis exec ansible --version
, it outputs:
ansible 2.10.17
config file = /Users/username/path/to/project/trellis/ansible.cfg
configured module search path = ['/Users/username/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/username/path/to/project/trellis/.trellis/virtualenv/lib/python3.9/site-packages/ansible
executable location = /Users/username/path/to/project/trellis/.trellis/virtualenv/bin/ansible
python version = 3.9.14 (main, Jan 6 2023, 15:39:05) [Clang 14.0.0 (clang-1400.0.29.202)]
That also displays python 3.9.14?
The test_challenges.py file where http.client
gets imported also has a shebang line that points to my python3 path.
Any thoughts why this is happening?
I have never seen this one before, thanks!