# Copyright (c) 2019 Dell Inc. or its subsidiaries. All Rights Reserved.
---

- name: Build organization payload
  set_fact:
    org_data: '{ "name": "{{ organization.name }}", "description": "{{ organization.description }}", "custom_virtualenv": null }'

- name: Create organization - "{{ organization.name }}"
  shell: >
    kubectl exec -it -n ngci-consul {{ consul_pod_name.stdout }} -c ngci-secret-storage-consul --
    curl -XPOST -u {{ awx_admin_username }}:{{ awx_admin_password }} {{ awx_service_address }}/api/v2/organizations/ -H 'Content-Type: application/json' -d '{{ org_data | to_json }}'
  no_log: "{{ enforce_no_log }}"
