Hi Guys ,
i am attempting to initialise list (array) with set_fact method with some dynamic values through with_items ; but getting failure for same ; it seems like my list is acting as a normal variable and printing the last value assigned to it.
here’s the playbook for same .
---
- hosts: wallet
tasks:
- name: Verifying existence of stat directory
file: path=/tmp/ansibleTest state=directory
- name: Identify current logging directory
find: paths="/tmp/ansibleTest/perf_output" file_type="directory" age="-2m" recurse="yes" age_stamp="mtime"
register: result
- debug: var=result
- set_fact: path="{{item.path}}"
with_items: "{{result.files}}"
- debug: var=path
path is acting as a normal variable and priniting last value assigned to it through - with_items: "{{result.files}}" ; I am expecting list of values contained by result.files[]
Kindly, reply what exactly i am doing incorrectly.
Kind Regards,
Ritesh .