dump-policies.sh 448 B

12345678910111213141516
  1. #!/bin/bash
  2. #
  3. # Create policy database backup.
  4. #
  5. # Need files:
  6. # api-token (api auth token)
  7. #
  8. E=central-rhacs.apps.ocp4.example.com
  9. T=$(cat roxctl-token)
  10. # Get a list of policy IDs
  11. IDS="$(curl -ks -H "Authorization: Bearer ${T}" https://${E}/v1/policies | jq -r '[ .policies[].id ]')"
  12. # Create a dump
  13. curl -ks -H "Authorization: Bearer ${T}" -XPOST -d "{ \"policyIds\": ${IDS} }" https://central-rhacs.apps.ocp4.example.com/v1/policies/export