Hi,

When i try this it works :

- name: Recuperation du contenu de /tmp
  find: 
    paths: "/tmp"
  register: tmp_directory_content

- debug:
    msg: "{{ item.path }}"
  with_items: "{{ tmp_directory_content.files }}"

I don't understand what's the difference with this : ?

- name: Affichage du contenu de chaque Oracle_Home sqlNet
  find: 
    paths: "{{ item.item }}/network/admin"
  register: tmp_oracle_sqlnet_content
  with_items: "{{ tmp_oracle_sqlnet_dir.results }}"
  when: item.stat.exists

- debug:
    msg: "{{ item.path }}"
  with_items: "{{ tmp_oracle_sqlnet_content.files }}"


Thanks for your help,

Matt


Le jeudi 22 avril 2021 à 10:31:05 UTC+2, [email protected] a écrit :

>
> Hi,
>
> I want to get into a variable the list of file present in a directory.
> - name: Affichage du contenu de chaque Oracle_Home sqlNet
>   find: 
>     paths: "{{ item.item }}/network/admin"
>   register: tmp_oracle_sqlnet_content
>   with_items: "{{ tmp_oracle_sqlnet_dir.results }}"
>   when: item.stat.exists
>
> I get the list into tmp_oracle_sqlnet_content variable.
>
> Here the results :
> {
>     "msg": {
>         "results": [
>             {
>                 "files": [
>                     {
>                         "uid": 500,
>                         "woth": false,
>                         "mtime": 1355715796,
>                         "inode": 134880,
>                         "isgid": false,
>                         "size": 381,
>                         "roth": true,
>                         "isuid": false,
>                         "isreg": true,
>                         "pw_name": "oracle",
>                         "gid": 500,
>                         "ischr": false,
>                         "wusr": true,
>                         "xoth": false,
>                         "rusr": true,
>                         "nlink": 1,
>                         "issock": false,
>                         "rgrp": true,
>                         "gr_name": "oinstall",
>                         "path": 
> "/soft/oracle/product/11.2/client/network/admin/shrept.lst",
>
> Now i tried to list the file in a debug message.
> - debug:
>     msg: "{{ item.path }}"
>   with_items: "{{ tmp_oracle_sqlnet_content.files }}"
>
> Ansible say that thisvariable has no files attributs :
> {
>     "msg": "'dict object' has no attribute 'files'",
>     "_ansible_no_log": false
> }
>
> Can you help me please?
>
> Thanks for you help,
>
> Matt
>

-- 
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/00d4058c-cc48-4c67-bb47-3b643a201fc3n%40googlegroups.com.

Reply via email to