Your second command contains a when clause. If it is skipped, ansible still registers the variable but there is no rc attribute in the data.

You need to take this into consideration when using the var in the next task. The following condition on last task should fix your issue.

    when: blaze_undeployment_status.rc | default('') == 0 or blaze_deployment_status.rc == 1
Answer from Zeitounator on Stack Overflow
🌐
GitHub
github.com › NVIDIA › deepops › issues › 335
'dict object' has no attribute 'rc' · Issue #335 · NVIDIA/deepops
August 31, 2019 - The error was: error while evaluating conditional (sudo.rc == 0): 'dict object' has no attribute 'rc' The error appears to have been in '/user/local/dgxuser/deepops/playbooks/bootstrap-sudo.yml': line 14, column 7, but may be elsewhere in the file depending on the exact syntax problem.
Author   NVIDIA
Discussions

'dict object' has no attribute 'rc'
=> { "msg": "The conditional check '(git_installed_version.rc != 0) or (git_reinstall_from_source | bool)' failed. The error was: error while evaluating conditional ((git_installed_version.rc != 0) or (git_reinstall_from_source | bool)): 'dict object' has no attribute 'rc'. More on github.com
🌐 github.com
5
November 23, 2022
shell module - error 'dict object' has no attribute 'rc' when running launchctl cmd
ISSUE TYPE Bug Report COMPONENT NAME shell module ANSIBLE VERSION ansible 2.2.0.0 config file = configured module search path = Default w/o overrides CONFIGURATION [defaults] inventory = hosts/host... More on github.com
🌐 github.com
3
November 13, 2016
Error while evaluating conditional (not ansible_check_mode and rvm1_gpg_keys != '' and (gpg_import is not defined or gpg_import.rc != 0)): 'dict object' has no attribute 'rc'
rvm1-ansible/tasks/rvm.yml, 'Import GPG keys from keyservers' on line 30 cause an error while evaluating conditional (not ansible_check_mode and rvm1_gpg_keys != '' and (gpg_import is not defined or gpg_import.rc != 0)): 'dict object' has no attribute 'rc' More on github.com
🌐 github.com
0
April 19, 2021
Ansible register result result.stdout result.rc etc dict variable not found, how to use until loop - Stack Overflow
The error was: error while evaluating conditional (result.rc == 0): 'dict object' has no attribute 'rc'" } More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitHub
github.com › ansible › ansible › issues › 41011
register command: dict_object has no attribute 'rc' · Issue #41011 · ansible/ansible
June 1, 2018 - The error was: error while evaluating conditional (frr_check_deb.rc == 1): 'dict object' has no attribute 'rc'\n\nThe error appears to have been in '/home/chris/ansible-vxlan/roles/frr/tasks/main.yml': line 12, 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: Copy .deb file to host and install it\n ^ here\n"}
Author   ansible
🌐
GitHub
github.com › geerlingguy › ansible-role-git › issues › 57
'dict object' has no attribute 'rc' · Issue #57 · geerlingguy/ansible-role-git
November 23, 2022 - => { "msg": "The conditional check '(git_installed_version.rc != 0) or (git_reinstall_from_source | bool)' failed. The error was: error while evaluating conditional ((git_installed_version.rc != 0) or (git_reinstall_from_source | bool)): 'dict object' has no attribute 'rc'.
Author   geerlingguy
🌐
Google Groups
groups.google.com › g › ansible-project › c › MKsKQ17D-zI
'rc' check failure - 'dict object' has no attribute 'rc'
July 7, 2018 - The error was: error while evaluating conditional (ipmask.rc != 0): 'dict object' has no attribute 'rc'\n\nThe error appears to have been in '/data/ansible-hpc/production/global/pkgs/20180703_2227/roles/ipmi/tasks/main.yml': line 14, column 7, but may\nbe elsewhere in the file depending on ...
🌐
Google Groups
groups.google.com › g › ansible-project › c › Ibr_VLPtQuc
Ansible distribution when upgrading centos 6 dict object' has no attribute error
October 14, 2022 - Look at the output to see what is returned. Also note that ALL of you prior tasks are "skipping". Maybe there is no 'rc' attribute because they are not executing. Figure out why they are all skipping.
🌐
GitHub
github.com › ansible › ansible-modules-core › issues › 5590
shell module - error 'dict object' has no attribute 'rc' when running launchctl cmd · Issue #5590 · ansible/ansible-modules-core
November 13, 2016 - => {"failed": true, "msg": "The conditional check 'syslocdb_check.rc > 1' failed. The error was: error while evaluating conditional (syslocdb_check.rc > 1): 'dict object' has no attribute 'rc'"} I'll run with -vvvv to see if I can capture additional output when there's an error.
Author   ansible
Find elsewhere
🌐
Red Hat
bugzilla.redhat.com › show_bug.cgi
2081361 – OSP16.2 Dry Run 'dict object' has no attribute 'rc'"}
Red Hat Bugzilla – Full Text Bug Listing · This site requires JavaScript to be enabled to function correctly, please enable it · Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla · Bug 2081361 · Privacy Contact FAQ Legal
🌐
GitHub
github.com › rvm › rvm1-ansible › issues › 226
Error while evaluating conditional (not ansible_check_mode and rvm1_gpg_keys != '' and (gpg_import is not defined or gpg_import.rc != 0)): 'dict object' has no attribute 'rc' · Issue #226 · rvm/rvm1-ansible
April 19, 2021 - Error while evaluating conditional (not ansible_check_mode and rvm1_gpg_keys != '' and (gpg_import is not defined or gpg_import.rc != 0)): 'dict object' has no attribute 'rc'#226
Author   rvm
🌐
YouTube
youtube.com › watch
How to Fix the dict object has No Attribute rc Error in Ansible - YouTube
Learn how to troubleshoot and resolve the recurring 'dict object' has no attribute 'rc' error in Ansible, especially during JBoss deployments.---This video i...
Published   August 26, 2025
Views   1
Top answer
1 of 2
5

Using tests as filters is deprecated. Instead of using result|succeeded use result is succeeded. This feature will be removed in version 2.9.

2 of 2
3

Correct answer and findings:

  1. In CentOS, if the action is successful and if the registered variable result is set, then a user can see these dict variables for ex: result.rc being 0, result.stdout = "something\nsomethingEsle\netc etc etc" and/or result.stdout_lines = "...same as above..." and result.results in some cases. If the action was failed, then I couldn't see result.stdout getting set in my case for using yum module if that failed due to connection reset or other reason. In that case, the only dict variable available for a failed action was result.rc != 0. Thus, in the until loop, until: result.rc == 0 condition worked for both successful/failed case for CentOS.

  2. In Ubuntu, if the apt module action was successful, I got result.stdout and result.stdout_lines variables set but no result.rc dict variable set. For a failed operation, there's was no result.stdout or result.stdout_lines or result.rc dict variables set. SO, in case of Ubuntu, I couldn't use until loop using one of these dictionary variables.

The only workaround I can think of is, to wrap the apt-get install <pacakge> in a script and use until loop in BASH etc to do what Ansible is doing. At least, that'll be little easier to code and if the exit code is not 0, then I can use until.

But, I finally found a solution, which works in Ubuntu for both successful and failed cases:

Jinja2 filters may help i.e. when: result|failed therefore, if I have to use a registered variable result for a FAILED condition, then using with until, I'll use it (opposite of failed status) i.e. as:

until: result|succeeded

The good thing is that, the above until statement will work for both CentOS and Ubuntu and for both successful/failed states.

🌐
Reddit
reddit.com › r/ansible › shell module not working correctly in 2.14.6
r/ansible on Reddit: shell module not working correctly in 2.14.6
July 1, 2023 -

Hi

The following play works well with ubuntu 20.04 but fails with kali.

- name: Installing or updating RCLONE if required
 register: output
 shell: "curl https://rclone.org/install.sh | bash"
 args:
   warn: no
 failed_when: "output.rc == 1  or output.rc == 2  or output.rc == 4"
 changed_when: "output.rc == 0 "

Error on kali

fatal: [localhost]: FAILED! => {"changed": false, "changed_when_result": "The conditional check 'output.rc == 0' failed. The error was: error while evaluating conditional (output.rc == 0): 'dict object' has no attribute 'rc'. 'dict object' has no attribute 'rc'", "msg": "Unsupported parameters for (ansible.legacy.command) module: warn. Supported parameters include: _raw_params, _uses_shell, argv, chdir, creates, executable, removes, stdin, stdin_add_newline, strip_empty_ends."}

I have been trying to fix this on kali running

ansible --version                                                                           
ansible [core 2.14.6]
  config file = None
  configured module search path = ['/home/whitehat/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/whitehat/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True

Any Idea how to fix it?

Regards, SD

🌐
The Mail Archive
mail-archive.com › ansible-project@googlegroups.com › msg55443.html
[ansible-project] 'dict object' has no attribute
December 14, 2020 - The error was: error while evaluating conditi onal (user_exists.rc == 0): 'dict object' has no attribute 'rc'\n\nThe error appears to be in '/home/student/acer/lock-user1.yml': line 20, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line ...
🌐
GitHub
github.com › cloudsidedev › appside › issues › 68
Error while evaluating conditional, 'dict object' has no attribute 'rc' · Issue #68 · cloudsidedev/appside
March 17, 2017 - TASK [db : bootstrap-pxc (RedHat family)] ************************************** fatal: [atlantis]: FAILED! => {"failed": true, "msg": "The conditional check 'bootstrap_check.rc == 1 and conf_wsrep_master == true and ansible_os_family ==...
Author   cloudsidedev
🌐
Elastic
discuss.elastic.co › elastic stack › elasticsearch
ELK Upgrade Error from 7.9.3 to 7.13.4 Using Ansible - Elasticsearch - Discuss the Elastic Stack
August 10, 2021 - FAILED! => {"msg": "The conditional check 'redhat_elasticsearch_install_from_repo.rc == 0' failed. The error was: error while evaluating conditional (redhat_elasticsearch_install_from_repo.rc == 0): 'dict object' has no attribute 'rc'"} This is the error i get when i run the ansible playbook...
🌐
Ansible
forum.ansible.com › archives › ansible project
'rc' check failure - 'dict object' has no attribute 'rc' - Ansible Project - Ansible
July 8, 2018 - Hi, I am new in ansible world, trying to figure out playbook where I use ‘grep’ to check for netmask address from a text file and capture the exit code with ‘register’ ( see below). My vars/main.yml looks like this: ipmitool_lan: root: netmask: 255.0.0.0 defgw: 10.1.1.1 My tasks/main.yml looks like this:
🌐
IssueHunt
oss.issuehunt.io › r › rvm › rvm1-ansible › issues › 226
'dict object' has no attribute 'rc' #226
IssueHunt 🦉 = OSS Development ⚒ + Bounty Program 💰. IssueHunt is an issue-based bounty platform for open source projects. Anyone can put a bounty on not only a bug but also on OSS feature requests listed on IssueHunt. Collected funds will be distributed to project owners and contributors.
🌐
Ansible
forum.ansible.com › archives › ansible project
'dict object' has no attribute.... - Ansible Project - Ansible
February 13, 2024 - I’ve been working this issue for a week now. The code used to work perfectly and now it fails. Here is the error I get: The task includes an option with an undefined variable. The error was: {‘CentOS’: ‘{{ iptables_dire…
🌐
Mail Archive
mail-archive.com › search
subject:"\[ansible\-project\] 'dict object' has no attribute"
The error was: error while evaluating conditi onal (user_exists.rc == 0): 'dict object' has no attribute 'rc'\n\nThe error appears to be in '/home/student/acer/lock-user1.yml': line 20, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line ...