Create a new user.

Hi!

Is there a way so to specify “last line” in tags from a list?. I want to create a new user by using adhocs command. So it won’t have to go through all the userlist everytime. Only the last added line. In this case - { id: ‘7’ , user: ‘user7’ }

tasks - main.yml:

  • name: Add vnc users
    user: name={{ item.user }} home={{ home_dir }}/{{ item.user }}
    with_items:
  • “{{ vnc_servers }}”
    tags: addnewuser

vars - main.yml:

Have you tried using the “last” filter?

with_items:

  • “{{ vnc_servers | last }}”