read_csv

Collection: community.general

Full Name: parallax.community.general.read_csv

Aliases: community.general.read_csv, read_csv

Controller module — runs on the local controller, not on remote hosts.

Synopsis

Read a CSV file into a list or dictionary of records

Parameters

NameTypeRequiredDefaultDescription
pathstringyesPath to the CSV file to read
keystringColumn name to use as dictionary key for the resulting data
delimiterstring,Field delimiter character
fieldnamesstringComma-separated list of field names to use as column headers
skipinitialspaceboolfalseSkip whitespace after the delimiter
strictboolfalseRaise an error on bad CSV input
uniquebooltrueIf true, require unique key values when using key parameter

Example

- name: Load the user roster keyed by username
  read_csv:
    path: files/users.csv
    key: username