I have the following in my playbook, and when it writes the contents it 
writes in this format:

ServerA:
 sudoers

ServerB:
 sudoers

ServerA:
 other_users

ServerB:
 other_users.

How can I get this to write ServerA sudoers and other_users first, and then 
move on to serverB? and so on..../

- name: Write users
  lineinfile:
    dest: "/tmp/users.txt"
    line: "HOST: {{ansible_nodename}}\n{{item}}\n\n"
    insertafter: EOF
    create: yes
    state: present
  delegate_to: localhost
  with_items:
    - "{{sudoers.stdout_lines|to_nice_json}}"
    - "{{other_users.stdout_lines|to_nice_json}}"
  notify:
    - email
    - cleanup


-- 
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/3075490e-d902-41a0-86dc-b2b2508ff24a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to