This worked fine without ccode and ipseg entries in the listing.yml. I have multiple entries for path which i loop over and construct the allinonecmd string but the ccode is just needed once.
I get this error with a single entry of ccode in listing.yml
fatal: [10.0.0.15]: FAILED! => { "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'ccode'
For my existing playbook to work i have to specify ccode and ipseg under each entry like below which works but looks ugly. It should be specified just one time and the playbook should work.
I need to get the output of ls command from list of remote ips and under each ip there is are different directories. The output of ls command needs to be saved in a file and the name of the file should be the value of ccode variable under the variable.
Thus my variable file has ip listed. Under each ip is the list of directories with name and path variables and finally the entire output of all the ls commands on all the directories for that ip is stored in a file with ccode variable.
I need to get the output of ls command from list of remote ips and under each ip there is are different directories. The
output of ls command needs to be saved in a file and the name of the file should be the value of ccode variable under
the variable.
Thus my variable file has ip listed. Under each ip is the list of directories with name and path variables and finally
the entire output of all the ls commands on all the directories for that ip is stored in a file with ccode variable.
Hope the requirement is clear now.
It is still unclear what you are going to do with the ls output. Also I would recommend to use the find module instead
of ls on the target.
The reason for grabbing the ls output across servers is for audit purpose. The output of ls is send as reports and audit team uses the ls output reports to do random checks on the server.