Hi, trying manage dashboard permissions using Ansible uri and Grafana API.
- name: update permissions
uri:
url: "http://{{ ansible_host }}:3000/api/dashboards/id/{{ _result.json.dashboard.id }}/permissions"
user: "{{ grafana_admin_user }}"
password: "{{ grafana_admin_password }}"
force_basic_auth: yes
method: POST
headers:
Accept: application/json
Content-Type: application/json
body:
items:
role: "Viewer"
permission: 1
body_format: json
Error: cannot unmarshal object into Go struct field UpdateDashboardAclCommand.items of type
The reason is to use the ‘items’ key, which is the reserved word in Ansible. Other keys work.
Is there a workaround or aliases in Grafana API for such keys?
API:
reserved keys:
https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#creating-valid-variable-names