---
- name: Create inventory in Tower
  uri:
    method           : POST
    force_basic_auth : yes
    url_username     : "{{ __tower_user}}"
    url_password     : "{{ __tower_pass}}"
    url              : "{{ __tower_url }}/api/v2/inventories/"
    status_code      :
      - 200
      - 201
    headers:
      Content-type   : application/json
    body:
      name           : "{{ __inventory }}"
      organization   : "{{ __organization }}"
    body_format      : json
    return_content   : no
    validate_certs   : no
  ignore_errors      : yes
  register           : r_inventory
  when               :
    - __inventory not in r_inventory_list


...
