ansible / ansible-modules-core

Ansible modules - these modules ship with ansible
1.3k stars 1.95k forks source link

'dict object' has no attribute 'stdout' #5893

Closed prasanjit- closed 7 years ago

prasanjit- commented 7 years ago

Below is the snippet:

  - name: Get master log file from master host one
    shell: mysql -u root -e "show master status;" | grep -v 'File' | awk '{print $1}'
    when: inventory_hostname == 'master_one'
    register: mysql_log_one

  - name: Write to file
    shell:  echo "{{ master_two }} {{ slave_user }} {{ mysql_log_one.stdout }} {{ mysql_logpos_one.stdout }}"  > /tmp/test
    when: inventory_hostname == 'master_one'

Here, echoing to /tmp/test work fine. No errors are thrown by ansible about 'dict object' for {{ mysql_log_one.stdout }} .

But,

does not work. mysql_log_two is another variable whose value is present!

Error msg: TASK [Configure master one] *** skipping: [master_two] => (item=mysql-bin.000066) fatal: [master_one]: FAILED! => {"failed": true, "msg": "'dict object' has no attribute 'stdout'"} ...ignoring

You can see (item=mysql-bin.000066) i.e. item is getting the value from mysql_log_two.stdout

ansibot commented 7 years ago

This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible

Please read through the repomerge page in the dev guide.