now . I has run two comands and register the two variable , when I call
the variable , the variable Unavailable (undefined)
flowing is my playbook:
---
- hosts: 127.0.0.1
connection: local
tasks:
- name: test
shell: df -{{ item.command }}
register: "{{ item.res }}"
with_items:
- { command: h, res: cange }
- { command: i, res: cange1 }
- name: xxx1
shell: echo "{{ cange.results[0].stdout }}" >/tmp/xxx
- name: xxx2
shell: echo "{{ cange1.results[0].stdout }}" >/tmp/xxx1
the error information:
TASK: [xxx1]
******************************************************************
fatal: [127.0.0.1] => One or more undefined variables: 'cange' is undefined
FATAL: all hosts have already failed -- aborting
Who can help me ! thank you very much.
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/736a3855-7636-4220-98e7-9366e0211c04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.