I am trying to build a hash of users from a csv file. I am stuck on this
last step, where the playbook just hangs:
- name: print user details into hash
lineinfile: 'dest=~csit-ansible/files/auto_students.yml
line="{{ item }}"
state=present'
with_items:
- " username: {{ item[0] }}"
- " firstname: {{ item[1] }}"
- " lastname: {{ item[2] }}"
- " studentid: {{ item[3] }}"
- " dob: {{ item[4] }}"
with_nested:
- "{{ usernames.stdout_lines }}"
- "{{ firstnames.stdout_lines }}"
- "{{ lastnames.stdout_lines }}"
- "{{ studentids.stdout_lines }}"
- "{{ dobs.stdout_lines }}"
Earlier in the playbook, I register the values like so:
- name: print all usernames to stdout
shell: awk -F ':' '{print $1}' ~csit-ansible/files/sortedu${date}.csv
register: usernames
- name: print all firstnames to stdout
shell: awk -F ':' '{print $2}' ~csit-ansible/files/sortedu${date}.csv
register: firstnames
- name: print all lastnames to stdout
shell: awk -F ':' '{print $3}' ~csit-ansible/files/sortedu${date}.csv
register: lastnames
- name: print all studentids to stdout
shell: awk -F ':' '{print $4}' ~csit-ansible/files/sortedu${date}.csv
register: studentids
- name: print all dobs to stdout
shell: awk -F ':' '{print $5}' ~csit-ansible/files/sortedu${date}.csv
register: dobs
--
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/86472bd9-5936-4acd-a744-19a309faac35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.