On 04.10.2016 09:54, Asil Carlin wrote:
Hi Kai,

Thanks for taking the time to reply. I did first try using with_lines and the awk command and using "item +", that throws up another error: This code

---

- hosts: localhost
  become: True
  become_user: root

  tasks:

  - name: get groups
    command: /usr/bin/awk -F',' '!/^#/ && !/^$/ { print $1 }' /var/tmp/
groups.csv
    register: groups_out

  - debug: var=groups_out.stdout_lines

  - name: Process groups one
    group: >
name={{ lookup('csvfile', item + 'file=groups.csv col=0 delimiter=,') }} gid={{ lookup('csvfile', item + 'file=groups.csv col=1 delimiter=,') }} state={{ lookup('csvfile', item + 'file=groups.csv col=2 delimiter=,') }} system={{ lookup('csvfile', item + 'file=groups.csv col=3 delimiter=,') }}

If you look carefully at my example I have a space in front of file.
Without it your name would be like this on first iteration

  lookup('csvfile', 'accountfile=groups.csv col=0 delimiter=,')

And this is not a valid lookup.

--
Kai Stian Olstad

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c1b2a8c1933e7c319f8ff1b5b31d7a59%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to