'rc' check failure - 'dict object' has no attribute 'rc'

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:

Hi Imam Toufique

ipmask variable contains complex data structure, just try 

Hi Daria,

that worked! thanks. But, I am not sure how it did though :slight_smile: ‘-debug’ output for ipmask produces the following:

TASK [ipmi : debug] **********************************************************************************************
task path: /data/ansible-hpc/production/global/pkgs/20180703_2227/roles/ipmi/tasks/main.yml:15
ok: [compute-13-11] => {
“<type ‘dict’>”: "VARIABLE IS NOT DEFINED!: "
}

Would you mind explaining your solution a bit?

thanks again! Very much appreciated!

When outputting a variable with debug, you do NOT use the curly braces.

If you use the curly braces, you are asking debug to output a variable with the name contained in ipmask, rather than the value of ipmask itself. Because the value contained in ipmask is not the name of a variable, debug complains that it is not defined.

Run this to see what I am talking about:

Does anyone know how to do vmotion all the vms from one host to another hosts by using ansible.