Passing values in a file

Hi,

I’m using Ansible 2.0.0.2 to create multiple directories by passing path to directories in a file and reading the values from file. How can multiple values be passed in a single file? Please revert with the format in which values (i.e. path to directories) should be passed in the file.

Thanks & Regards,
Rakshatha

Can you show an example of what you are trying to accomplish?

  • name: Create directory structure
    hosts: newserver
    tasks:
  • name: Directory structure
    win_file: path=“{{ item }}” state=directory

with_file:

  • first_example_file

Above is the ansible script I’m using to create directory, path to the new directory is given in the file ‘first_example_file’. How should we pass multiple values in the file (i.e. when we have to create multiple directories, what is the format of tje file?)

This stackoverflow article explains how to iterate over multiple lines in a file with ansible: http://stackoverflow.com/questions/33541870/how-do-i-loop-over-each-line-inside-a-file-with-ansible

Thank you, with_lines module was very much helpful

With_lines module is working fine when I pass values for single parameter. How to pass values for multiple parameters in a single file?

For example: win_file: path=“{{ item }}” state=“{{ item }}”

In the above example values for path and state should be passed. Is it possible to accomplish this using with_lines? Please help…