I'm trying to do a csvlookup that references a variable so I can dynamically choose which line of the file. I tried the first two thinks to do the lookup with name only the third directly referencing the name works
- hosts: "{{ target }}"
vars:
name : "REALUSER"
uid : "{{ lookup('csvfile', ''name delimiter=: file=/etc/passwd col=2 ') }}"
gid : '{{ lookup("csvfile", name + "file=/etc/passwd col=3 delimiter=:") }}'
comment : '{{ lookup("csvfile", "REALUSER file=/etc/passwd delimiter=: col=4") }}'
tasks:
- debug: msg="The uid is {{ uid }} and the name is {{name}} and the gid is {{ gid }}"