Using CLI

Learn how to create a role in Ranger using CLI.

Ensure that you have the Administrator user name and password for Ranger.
  1. Open a terminal on your device.
  2. Run the following curl command to create a role in Ranger:
    curl -u [***RANGER_ADMIN_USERNAME***]:[***RANGER_ADMIN_PASSWORD***] \
     --include --location \
     --request POST \
      --header "Content-Type: application/json" \
      --header "accept: application/json" \
      --data '{
        "name": "[***ROLE_NAME***]",
        "description": "[***ROLE_DESCRIPTION***]"
      }' \
      "[***RANGER_URL***]/service/roles/roles"

    Example,

    curl -u admin:Admin123 \
     --include --location \
     --request POST \
      --header "Content-Type: application/json" \
      --header "accept: application/json" \
      --data '{
        "name": "iceberg-data-all-access",
        "description": "Iceberg data all access"
      }' \
      "https://ranger-host.example.com:6182/service/roles/roles"