packages = p['package'].split(',')\r\nAttributeError:

94 views
Skip to first unread message

hilali lui

unread,
Mar 1, 2016, 4:33:22 PM3/1/16
to Ansible Project
Hello,


When I use this:

- name: Install {{ install_name }} required tools
  apt:  pkg={{ item }}
        state=installed
        update_cache=yes


I found this error :

failed: [192.168.8.123] => (item=[u'sudo', u'vim', u'tree', u'git', u'gcc', u'iotop', u'htop', u'build-essential', u'xfonts-base', u'xfonts-encodings', u'xfonts-75dpi', u'xfonts-utils', u'libfontenc1', u'libffi-dev', u'libssl-dev', u'libevent-dev', u'libgeos-dev', u'libldap2-dev', u'libsasl2-dev', u'libxfont1', u'libxml2', u'libxml2-dev', u'libxslt1.1', u'libxslt1-dev', u'libxslt-dev', u'node-clean-css', u'node-less']) => {"failed": true, "invocation": {"module_name": "apt"}, "item": ["sudo", "vim", "tree", "git", "gcc", "iotop", "htop", "build-essential", "xfonts-base", "xfonts-encodings", "xfonts-75dpi", "xfonts-utils", "libfontenc1", "libffi-dev", "libssl-dev", "libevent-dev", "libgeos-dev", "libldap2-dev", "libsasl2-dev", "libxfont1", "libxml2", "libxml2-dev", "libxslt1.1", "libxslt1-dev", "libxslt-dev", "node-clean-css", "node-less"], "module_stderr": "OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 20859\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 192.168.8.123 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/root/.ansible/tmp/ansible-tmp-1456851197.83-39434127468758/apt\", line 2407, in <module>\r\n    main()\r\n  File \"/root/.ansible/tmp/ansible-tmp-1456851197.83-39434127468758/apt\", line 448, in main\r\n    p'list' object has no attribute 'split'\r\n", "msg": "MODULE FAILURE", "parsed": false}

Joanna Delaporte

unread,
Mar 1, 2016, 6:06:38 PM3/1/16
to Ansible Project
I just had a few weird attribute errors that were caused by having multiple installations of Ansible. I had a system install and I was trying to use a Github clone of Ansible.
 
You can use the following command to see where your system Ansible locations might be (thanks to Matt Martz):
$ python -c "import sys; print sys.path"

hilali lui

unread,
Mar 2, 2016, 3:34:34 AM3/2/16
to Ansible Project
Thank yoou for your reponse  I found

ahilali@ahilali-desktop:~$ python -c "import sys; print sys.path"
['', '/usr/local/lib/python2.7/dist-packages/ansible-2.0.0.2-py2.7.egg', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']

Joanna Delaporte

unread,
Mar 2, 2016, 10:25:52 AM3/2/16
to Ansible Project
That looks okay, unless you are also running Ansible from the Github repo. 

Can you paste the full play here, including the variables that are being read into the play?

Thanks!
Joanna

Brian Coca

unread,
Mar 2, 2016, 6:46:20 PM3/2/16
to ansible...@googlegroups.com
that is not a good key=val multiline, do one of these:

  apt:  
   pkg: "{{ item }}"
   state: installed
   update_cache: yes

or
  apt:  |
        pkg={{ item }}
        state=installed
        update_cache=yes

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/14f4593b-69b5-414f-b552-adfa26f0f504%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages