Roots Discourse

Name 'unicode' is not defined


#1

I’m trying to deploy but seem to get some errors. I have Python 2.7.14.

Command: ansible-playbook server.yml -e env=production

PLAY [Ensure necessary variables are defined] ******************************************************************
 [WARNING]: Failure using method (v2_playbook_on_play_start) in callback plugin (<ansible.plugins.callback./hom
e/User/trellis/example.com/trellis/lib/trellis/plugins/callback/vars.CallbackModule object at 0x6fff89012b0>):
'dict' object has no attribute 'iteritems'

 [WARNING]: Skipping plugin (/home/User/trellis/example.com/trellis/lib/trellis/plugins/vars/version.py) as it
seems to be invalid: Trellis does not yet support Python 3.6.4.  Please use Python 2.7.


TASK [Ensure environment is defined] ***************************************************************************
 [WARNING]: Failure using method (v2_runner_on_skipped) in callback plugin
(<ansible.plugins.callback.output.CallbackModule object at 0x6fffd50e8d0>): name 'unicode' is not defined


PLAY [Test Connection and Determine Remote User] ***************************************************************

TASK [connection : Require manual definition of remote-user] ***************************************************

TASK [connection : Specify preferred HostKeyAlgorithms for unknown hosts] **************************************

TASK [connection : Check whether Ansible can connect as root] **************************************************
 [WARNING]: Failure using method (v2_runner_on_failed) in callback plugin
(<ansible.plugins.callback.output.CallbackModule object at 0x6fffd50e8d0>): name 'unicode' is not defined

        to retry, use: --limit @/home/User/trellis/example.com/trellis/server.retry

PLAY RECAP *****************************************************************************************************
ip-here              : ok=0    changed=0    unreachable=0    failed=1
localhost                  : ok=0    changed=0    unreachable=0    failed=0

#2

I have Python 2.7.14.

Are you sure?

Name ‘unicode’ is not defined` is a Python 3 error. The output you included has this as well:

[WARNING]: Skipping plugin (/home/User/trellis/example.com/trellis/lib/trellis/plugins/vars/version.py) as it
seems to be invalid: Trellis does not yet support Python 3.6.4. Please use Python 2.7.

Trellis doesn’t support Python 3 yet but it’s being worked on here: https://github.com/roots/trellis/pull/1031


#3

ooh, looks like i have 3.6 also installed.

I uninstalled 3.6 now i get

$ ansible-playbook server.yml -e env=production
Traceback (most recent call last):
  File "/usr/bin/ansible-playbook", line 67, in <module>
    import ansible.constants as C
  File "/usr/lib/python3.6/site-packages/ansible/constants.py", line 11, in <module>
    from jinja2 import Template
ImportError: cannot import name 'Template'

#4

This is much more of a Python issue than a Trellis one, and unfortunately we can’t effectively support Python on this forum. I recommend Stack Overflow, or other general support resources for troubleshooting this issue.


#5

I solved that issue with python and now im getting this

command: ansible-playbook server.yml -e env=production
Ubuntu 18

TASK [sshd : Create a secure sshd_config] ********************************************
System info:
  Ansible 2.4.0.0; Linux
  Trellis version (per changelog): "Allow customizing Nginx `worker_connections`"
---------------------------------------------------
failed to validate
/root/.ansible/tmp/ansible-tmp-1543843108.07-179736200174781/source line 20:
Bad SSH2 mac spec 'hmac-sha2-512-etm@openssh.com,hmac-
sha2-256-etm@openssh.com,hmac-
ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-
sha2-256,hmac-ripemd160'.

fatal: [192.81.220.27]: FAILED! => {"changed": false, "checksum": "0089b96692ca3d50a8a31d673d7705f91fe871a7", "exit_status": 255, "failed": true, "stderr_lines": ["/root/.ansible/tmp/ansible-tmp-1543843108.07-179736200174781/source line 20: Bad SSH2 mac spec 'hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160'."], "stdout": "", "stdout_lines": []}