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