forked from bfraser/puppet-grafana
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a task for setting the admin user's password
This task will allow you to change the admin user's password without having to remember the curl command for the Grafana API.
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"puppet_task_version": 1, | ||
"supports_noop": false, | ||
"description": "Change the Grafana admin user's password", | ||
"parameters": { | ||
"old_password": { | ||
"description": "The old admin password", | ||
"type": "Optional[String[1]]", | ||
"sensitive": true | ||
}, | ||
"new_password": { | ||
"description": "The new admin password", | ||
"type": "Optional[String[1]]", | ||
"sensitive": true | ||
}, | ||
"uri": { | ||
"description": "http or https", | ||
"type": "Enum['http','https']" | ||
}, | ||
"port": { | ||
"description": "The port Grafana is running on", | ||
"type": "Integer" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
payload="{ | ||
\"oldPassword\": \"$PT_old_password\", | ||
\"newPassword\": \"$PT_new_password\", | ||
\"confirmNew\": \"$PT_new_password\" | ||
}" | ||
|
||
cmd="/usr/bin/curl -X PUT -H 'Content-Type: application/json' -d '$payload' '$PT_uri://admin:$PT_old_password@localhost:$PT_port/api/user/password'" | ||
eval "$cmd" |