On this page
community.grafana.grafana_team – Manage Grafana Teams
Note
This plugin is part of the community.grafana collection (version 1.2.3).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.grafana.
To use it in a playbook, specify: community.grafana.grafana_team.
New in version 1.0.0: of community.grafana
Synopsis
- Create/update/delete Grafana Teams through the Teams API.
 - Also allows to add members in the team (if members exists).
 
Requirements
The below requirements are needed on the host that executes this module.
- The Teams API is only available starting Grafana 5 and the module will fail if the server version is lower than version 5.
 
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| client_cert
        
        path
         | 
      
        
        PEM formatted certificate chain file to be used for SSL client authentication.
        
       
        This file can also include the key as well, and if the key is included, client_key is not required
         | 
     |
| client_key
        
        path
         | 
      
        
        PEM formatted file that contains your private key to be used for SSL client authentication.
        
       
        If client_cert contains both the certificate and key, this option is not required.
         | 
     |
| email
        
        string / required
         | 
      
        
        The mail address associated with the Team.
         | 
     |
| enforce_members
        
        boolean
         | 
      
       
  | 
      
        
        Delete the members not found in the  
       members parameters from the
       
        list of members found on the Team.
         | 
     
| grafana_api_key
        
        string
         | 
      
        
        The Grafana API key.
        
       
        If set,  url_username and url_password will be ignored.
        | 
     |
| members
        
        list / elements=string
         | 
      
        
        List of team members (emails).
        
       
        The list can be enforced with  enforce_members parameter.
        | 
     |
| name
        
        string / required
         | 
      
        
        The name of the Grafana Team.
         | 
     |
| skip_version_check
        
        boolean
        
       
        added in 1.2.0 of community.grafana
         | 
      
       
  | 
      
        
        Skip Grafana version check and try to reach api endpoint anyway.
        
       
        This parameter can be useful if you enabled `hide_version` in grafana.ini
         | 
     
| state
        
        string
         | 
      
       
  | 
      
        
        Delete the members not found in the  
       members parameters from the
       
        list of members found on the Team.
         | 
     
| url
        
        string / required
         | 
      
        
        The Grafana URL.
        
       aliases: grafana_url  | 
     |
| url_password
        
        string
         | 
      Default: 
        "admin"
         | 
      
        
        The Grafana password for API authentication.
        
       aliases: grafana_password  | 
     
| url_username
        
        string
         | 
      Default: 
        "admin"
         | 
      
        
        The Grafana user for API authentication.
        
       aliases: grafana_user  | 
     
| use_proxy
        
        boolean
         | 
      
       
  | 
      
        
        If  no, it will not use a proxy, even if one is defined in an environment variable on the target hosts.
        | 
     
| validate_certs
        
        boolean
         | 
      
       
  | 
      
        
        If  
       no, SSL certificates will not be validated.
       
        This should only set to  no used on personally controlled sites using self-signed certificates.
        | 
     
Examples
---
- name: Create a team
  community.grafana.grafana_team:
      url: "https://grafana.example.com"
      grafana_api_key: "{{ some_api_token_value }}"
      name: "grafana_working_group"
      email: "foo.bar@example.com"
      state: present
- name: Create a team with members
  community.grafana.grafana_team:
      url: "https://grafana.example.com"
      grafana_api_key: "{{ some_api_token_value }}"
      name: "grafana_working_group"
      email: "foo.bar@example.com"
      members:
          - john.doe@example.com
          - jane.doe@example.com
      state: present
- name: Create a team with members and enforce the list of members
  community.grafana.grafana_team:
      url: "https://grafana.example.com"
      grafana_api_key: "{{ some_api_token_value }}"
      name: "grafana_working_group"
      email: "foo.bar@example.com"
      members:
          - john.doe@example.com
          - jane.doe@example.com
      enforce_members: yes
      state: present
- name: Delete a team
  community.grafana.grafana_team:
      url: "https://grafana.example.com"
      grafana_api_key: "{{ some_api_token_value }}"
      name: "grafana_working_group"
      email: "foo.bar@example.com"
      state: absent
  Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | |
|---|---|---|---|
| team
        
        complex
         | 
      On success | 
        
        Information about the Team
          | 
     |
| avatarUrl
        
        string
         | 
      always | 
        
        The url of the Team avatar on Grafana server
         Sample:
        
       
        ['/avatar/a7440323a684ea47406313a33156e5e9']
         | 
     |
| email
        
        string
         | 
      always | 
        
        The Team email address
         Sample:
        
       
        ['foo.bar@example.com']
         | 
     |
| id
        
        integer
         | 
      always | 
        
        The Team email address
         Sample:
        
       
        [42]
         | 
     |
| memberCount
        
        integer
         | 
      always | 
        
        The number of Team members
         Sample:
        
       
        [42]
         | 
     |
| members
        
        list / elements=string
         | 
      always | 
        
        The list of Team members
         Sample:
        
       
        [['john.doe@exemple.com']]
         | 
     |
| name
        
        string
         | 
      always | 
        
        The name of the team.
         Sample:
        
       
        ['grafana_working_group']
         | 
     |
| orgId
        
        integer
         | 
      always | 
        
        The organization id that the team is part of.
         Sample:
        
       
        [1]
         | 
     |
Authors
- Rémi REY (@rrey)
 
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/latest/collections/community/grafana/grafana_team_module.html