On 26. juli 2017 18:04, 'Dan Steffen' via Ansible Project wrote:
> maybe I am just blind but I spend today 2 hours to found out how to read
> from a CSV to create User at the moment I have something like
>
> - hosts: all
> user:
> name="{{ lookup('csvfile', 'item file=user.csv delimiter=, col=0') }}"
This is not a correct start of a play, you are missing tasks: and a dash
to indicate a list.
- hosts: all
tasks:
- user:
name=...
> and a CSV-File that looks like
>
> jdoe
> jkirk
> bwillis
This is not a Comma Separated Value file.
File like this one can be read by with_lines.
- debug: msg="The user is {{ item }}"
with_lines: cat user.csv
--
Kai Stian Olstad