I prepared a playbook as follows:
---
- hosts: localhost
  vars:
    directory_name: /root/raka-tests/
  tasks:
  - name: List the Contents of dir
    command: ls -lrt {{ directory_name }}
    register: files
  - debug:
      msg: "{{ files.stdout_lines}}"

o/p:
TASK [debug] 
***********************************************************************************************************************************************************
ok: [localhost] => {
    "msg": [
        "total 80",
        "-rw-r--r--. 1 root root  945 Jul 12 05:53 rel.yml",
        "-rw-r--r--. 1 root root  280 Jul 12 06:19 playbook.yaml",
        "-rw-r--r--. 1 root root  237 Jul 12 09:00 rakesh.yml",
        "-rw-r--r--. 1 root root  179 Jul 15 05:40 playbook2.yml",
        "-rw-r--r--. 1 root root  376 Jul 15 05:49 playbook3.yml",
        "-rw-r--r--. 1 root root  376 Jul 15 05:52 playbook4.yml",

I dont want to use command/shell  module. Is there any module which will 
show me the list sof contents of adirectory

-- 
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/cd9ca004-a446-4900-9fe1-180cd76a22eb%40googlegroups.com.

Reply via email to