- name: add group
  group:
    name: huanghao
    state: present

- name: add user
  become: true
  user:
    name: huanghao
    shell: /bin/bash
    password: "{{ 'password' | password_hash('sha512') }}"
    home: /home/huanghao
    groups: sudo,huanghao

- name: add group
  become: true
  group:
    name: newuser
    state: present

- name: add user
  become: true
  user:
    name: newuser
    shell: /bin/bash
    password: "{{ 'password' | password_hash('sha512') }}"
    home: /home/rbharath
    groups: sudo,newuser

Add task for new user
Add task for new user
