dict object has no attribute 'json'"} Ansible Error

71 views
Skip to first unread message

Deva Krishnan

unread,
May 28, 2019, 7:56:40 AM5/28/19
to Ansible Project
Hi @ansible folks,

Recently I found an Ansible error while installing Opnfv-Apex. I'm getting the below error message while deploying. It seems to be Ansible playbook failed error. 

Error Message :

2019-05-27 20:45:16,635 INFO: TASK [include_tasks] ***********************************************************
task path: /usr/share/opnfv-apex/ansible/playbooks/prepare_overcloud_containers.yml:31
fatal: [192.168.122.244]: FAILED! => {"msg": "The conditional check 'item in (response.json)['repositories']|join(\" \")' failed. The error was: error while evaluating conditional (item in (response.json)['repositories']|join(\" \")): 'dict object' has no attribute 'json'

The error appears to be in '/usr/share/opnfv-apex/ansible/playbooks/prepare_overcloud_containers.yml': line 31, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

      register: response
    - include_tasks: patch_containers.yml
      ^ here
"}


2019-05-27 20:45:16,635 INFO: PLAY RECAP *********************************************************************
192.168.122.244            : ok=5    changed=3    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   


2019-05-27 20:45:16,671 ERROR: Ansible playbook failed. See Ansible logs for details.
2019-05-27 20:45:16,671 ERROR: Unable to complete container prep on Undercloud
Traceback (most recent call last):
  File "/bin/opnfv-deploy", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.4/site-packages/apex/deploy.py", line 535, in main
    tmp_dir=APEX_TEMP_DIR)
  File "/usr/lib/python3.4/site-packages/apex/common/utils.py", line 146, in run_ansible
    raise Exception(e)
Exception: Ansible playbook failed. See Ansible logs for details.

===================================================================================================================================================



FYI :  Attached the yaml files of prepare_overcloud_containers.yml and patch_containers.yml below. Please let me know if you need any more information from my side. Hope some one can help me soon in this case.
Thanks in advance.

[root@localhost playbooks]# cat patch_containers.yml 
---
  - name: "Pull docker image to ensure it exists locally: {{ item }}"
    shell: "{{ container_client }} pull {{ undercloud_ip }}:8787/tripleo{{ os_version }}/centos-binary-{{ item }}:current-tripleo"
  - name: "Find docker image user {{ item }}"
    shell: >
      {{ container_client }} inspect --format='{{ '{{' }}.ContainerConfig.User{{ '}}' }}'
      {{ undercloud_ip }}:8787/tripleo{{ os_version }}/centos-binary-{{ item }}:current-tripleo
    register: user_result
  - name: "Patch docker image {{ item }}"
    shell: >
      cd /home/stack/containers/{{ item }} && {{ container_client }} build
      --build-arg REAL_USER={{ user_result.stdout }}
      -t {{ undercloud_ip }}:8787/tripleo{{ os_version }}/centos-binary-{{ item }}:apex .




      register: response
    - include_tasks: patch_containers.yml
      with_items: "{{ patched_docker_services }}"
      loop_control:
        loop_var: item
      when:
        - patched_docker_services|length > 0
        - item in (response.json)['repositories']|join(" ")








Dick Visser

unread,
May 28, 2019, 3:46:15 PM5/28/19
to ansible...@googlegroups.com
Did you get those playbooks from 
If so, just a link would have been sufficient, rather than copy pasting them as an unreadable piece of HTML email. 

In any case, those playbooks are part of a much larger set of playbooks and code. They’re highly specific to the OPNFV project. I would suggest asking the people/authors over there first.

Dick 

--
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/210adedc-bf8d-4cb8-b908-05bd65ef162f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

Deva Krishnan

unread,
May 29, 2019, 4:59:52 AM5/29/19
to Ansible Project
Hi Dick Visser,

Thank you for your advice. I will try to sort this out. For more help I will contact opnfv community.

Thanks & Regards,
Devakrishnan


On Wednesday, May 29, 2019 at 1:16:15 AM UTC+5:30, Dick Visser wrote:
Did you get those playbooks from 
If so, just a link would have been sufficient, rather than copy pasting them as an unreadable piece of HTML email. 

In any case, those playbooks are part of a much larger set of playbooks and code. They’re highly specific to the OPNFV project. I would suggest asking the people/authors over there first.

Dick 
To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages