---
- name: Create user
  os_user:
     cloud: "{{ cloud }}"
     state: present
     name: ansible_user
     password: secret
     email: ansible.user@nowhere.net
     domain: default
     default_project: demo
  register: user

- name: Assign user to nonadmins group
  os_user_group:
     cloud: "{{ cloud }}"
     state: present
     user: ansible_user
     group: nonadmins

- name: Remove user from nonadmins group
  os_user_group:
     cloud: "{{ cloud }}"
     state: absent
     user: ansible_user
     group: nonadmins

- name: Delete user
  os_user:
     cloud: "{{ cloud }}"
     state: absent
     name: ansible_user
