---
- name: Extract PS output.
shell: "ps -ef | grep pmon"
register: pmon
- name: Display PS output.
debug:
msg:
- "{{ pmon.stdout_lines }}"
Error:
ERROR! 'shell' is not a valid attribute for a Play
The error appears to be in '/root/ansible_code/roles/sample_exercise/tasks/extractPS.yml': line 2, column 4, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- name: Extract PS output.
^ here
Please advise on this error.
Command I am running:
[root@ansiblehost tasks]# pwd
/root/ansible_code/roles/sample_exercise/tasks
[root@ansiblehost tasks]# ansible-playbook -i /root/ansible_code/inventory.ini /root/ansible_code/roles/sample_exercise/tasks/extractPS.yml --syntax-check