Here is my play book, i am trying to check the id's using wildcards like
ora****
I am getting variable not defined
---
- hosts: node1.example.com
gather_facts: no
ignore_unreachable: yes
tasks:
- shell: "cat /etc/passwd|awk -F : '{print $1}'|grep -i '^ora.*$'"
register: userid
ignore_errors: true
- shell: id "{{ item }}"
register: id
with_items: "{{ userid.stdout.split('\n') }}"
- debug:
var: id.stdout_lines
----------------------------
OUTPUT
PLAY [node1.example.com]
************************************************************************************************************************************************************************************************
TASK [shell]
******************************************************************************************************************************************************************************************************
changed: [node1.example.com]
TASK [shell]
******************************************************************************************************************************************************************************************************
changed: [node1.example.com] => (item=oraabc)
changed: [node1.example.com] => (item=orapq3)
changed: [node1.example.com] => (item=orapqj)
changed: [node1.example.com] => (item=oracle)
TASK [debug]
******************************************************************************************************************************************************************************************************
ok: [node1.example.com] => {
"id.stdout_lines": "VARIABLE IS NOT DEFINED!"
}
PLAY RECAP
********************************************************************************************************************************************************************************************************
node1.example.com : ok=3 changed=2 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/a5f12a78-9661-43fb-8821-1bfe7ded77f7n%40googlegroups.com.