Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3637

How to assign SLA rubrik backup for SQL Server availability group with graphsql and REST API using ansible playbook with uri module?

$
0
0

I need to assign SLA rubrik backup RSC for a SQL Server availability group databases. I tried Rubrik Backup API to achieve this, I got confused. Now I tried the graphql query to get assign SLA for SQL AG DB.

In the graphql query approach, I have a query to cluster the UUID using cluster name. To assign SLA, we need the SQL Server availability group ID, database id and SLA domain ID. I didn't find any docs specific to get the SQL Server availability group or database id and SLA domain ID.

Below is the code:

- name: Connect to Rubrik  uri:    url: "{{ access_token_uri }}"    method: POST    body_format: json    body:      client_id: "{{ rubrik_rsc_id }}"      client_secret: "{{ rubrik_rsc_secret }}"  register: rsc- ansible.builtin.debug:    msg: "{{ rsc.json.access_token }}"- ansible.builtin.set_fact:   rubrik_token: "{{ rsc.json.access_token }}"- name: Get Cluster UUID using cluster name  uri:    url: "{{ rubrik_inst_url }}/api/graphql"    method: POST    headers:      Authorization: "Bearer {{ rubrik_token }}"      Content-Type: "application/json"        body_format: json    timeout: 120    body:      query: '{{ lookup("file", "{{ get_cluster_info_query }}") }}'      variables: |        {"clustername": "{{targeted_cluster}}"        }  register: query_result- debug:    msg: "{{ query_result }}"- name: Get Database ID using cluster name  uri:    url: "{{ rubrik_inst_url }}/api/graphql"    method: POST    headers:      Authorization: "Bearer {{ rubrik_token }}"      Content-Type: "application/json"        body_format: json    timeout: 120    body:      query: '{{ lookup("file", "{{ get_mssqldb_id_query }}") }}'  register: dbquery_result- debug:    msg: "{{ dbquery_result }}"

graphql query to get cluster UUID:

query filteredCluster($clustername:[String!]){  clusterConnection(filter:{    name: $clustername  }) {    nodes{      id      name      status      defaultAddress      version    }      }}

GraphQL query to get SQL Server database ID, but I am expecting filter by specific db name:

query {  mssqlDatabases(first: 1000) {    edges {      node {        id        name      }    }  }}

Expected result is: I need SQL Server availability group and database ID for the specific database or availability group name and get SLA domain ID filter by the SLA domain name. I need the REST API endpoints to achieve the same


Viewing all articles
Browse latest Browse all 3637

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>