Bug 821396

Summary: [abrt] ansible-0.3.1-1.fc16: playbook.py:368:_run_task:AttributeError: 'str' object has no attribute 'get'
Product: [Fedora] Fedora Reporter: andreas.davour
Component: ansibleAssignee: Tim Bielawa <tbielawa>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: tbielawa
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:d7590c874f1d7ba271679a4bb8db29eba220828f
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-16 20:53:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description andreas.davour 2012-05-14 11:12:18 UTC
libreport version: 2.0.8
abrt_version:   2.0.7
cmdline:        /usr/bin/python /usr/bin/ansible-playbook -k Yaml/playbook-tc2-resolver.yaml
executable:     /usr/bin/ansible-playbook
kernel:         3.3.4-3.fc16.x86_64
reason:         playbook.py:368:_run_task:AttributeError: 'str' object has no attribute 'get'
time:           Mon 14 May 2012 11:04:00 AM CEST
uid:            1000
username:       ante

backtrace:
:playbook.py:368:_run_task:AttributeError: 'str' object has no attribute 'get'
:
:Traceback (most recent call last):
:  File "/usr/bin/ansible-playbook", line 100, in <module>
:    sys.exit(main(sys.argv[1:]))
:  File "/usr/bin/ansible-playbook", line 81, in main
:    pb.run()
:  File "/usr/lib/python2.7/site-packages/ansible/playbook.py", line 239, in run
:    self._run_play(pattern)
:  File "/usr/lib/python2.7/site-packages/ansible/playbook.py", line 572, in _run_play
:    port=port
:  File "/usr/lib/python2.7/site-packages/ansible/playbook.py", line 368, in _run_task
:    name    = task.get('name', None)
:AttributeError: 'str' object has no attribute 'get'
:
:Local variables in innermost frame:
:remote_user: 'root'
:conditional: False
:handlers: []
:pattern: 'tc2'
:self: <ansible.playbook.PlayBook object at 0xe94450>
:sudo: False
:task: 'name template in resolv.conf file'
:port: 22
:transport: 'paramiko'

comment:
:I ran the ansible playbook and it failed with the output shown. It happens everytime,
:
:Playbook:
:---
:- hosts: tc2
:  user: root
:  tasks:
:  - name resolver file copy
:  action: template src=/home/ante/Ansible/Yaml/resolv.conf-templ.j2 dest=/etc/resolv.conf
:
:the template file:
:# this is the resolv.conf for {{ ansible_hostname }}
:# template copied by ansible
:search a.snowmen.se
:timeout:1
:nameserver 172.30.0.18
:nameserver 172.30.0.12

Comment 1 Tim Bielawa 2012-05-16 20:53:17 UTC
(In reply to comment #0)
> comment:
> :I ran the ansible playbook and it failed with the output shown. It happens
> everytime,
> :
> :Playbook:
> :---
> :- hosts: tc2
> :  user: root
> :  tasks:
> :  - name resolver file copy
> :  action: template src=/home/ante/Ansible/Yaml/resolv.conf-templ.j2
> dest=/etc/resolv.conf

Looks like your YAML is a little off, it's VERY sensitive to indentation. Where you have:

> ---
> - hosts: tc2
>   user: root
>   tasks:
>   - name resolver file copy
>   action: template src=/home/ante/Ansible/Yaml/resolv.conf-templ.j2 dest=/etc/resolv.conf

You should have:

> ---
> - hosts: tc2
>   user: root
>   tasks:
>   - name resolver file copy
>     action: template src=/home/ante/Ansible/Yaml/resolv.conf-templ.j2 dest=/etc/resolv.conf


See this reference for an example with the correct syntax:

http://ansible.github.com/playbooks.html#playbook-example


If this doesn't fix the issue I invite you to visit the mailing lists or the IRC channel for official support. They will be able help you much better than I can.

The resources section of their website has that information: http://ansible.github.com/#resources

Thanks!