Web wrap your ansible module with the read_csv module and csv file name. Web this is needed if the csv does not have a header. Web i need to create jinja templates to generate ansible playbook for that i need to read datas from csv file. {{ lookup('file', './excel.csv') }} tasks: Csv file is similar to below (file name ansi.csv) aaa,bbb,ccc,ddd. The column name used as a key for the resulting dictionary. Localhost in the first task. Web to achieve this, use the read_csv module. Notice the use of delegate_to: Web ansible file lookup example.
Reader() is used to read the file, which returns an iterable reader object. (encrypt test*_var if you want to. Web ansible file lookup example. For community users, you are reading an unmaintained version of the ansible documentation. Load csv data into object read_csv: Web synopsis read a csv file and return a list or a dictionary, containing one dictionary per row. To print how ansible has parsed the csv, use the debug module. Ask question asked 1 year ago modified 1 year ago viewed 211 times 1 i'm trying to read from a list of. For example, given simplified inventory. Web wrap your ansible module with the read_csv module and csv file name. Parameters notes note ansible also ships with the csvfile lookup.