4848 required: true
4949 description:
5050 - Text to be displayed in the annotation
51- secure :
51+ dashboard_id :
5252 required: false
53- default: false
5453 description:
55- - If true, an https connection will be established with the Grafana server.
54+ - The dashboard id where the annotation will be added
55+ panel_id:
56+ required: false
57+ description:
58+ - The panel id where the annotation will be added
5659'''
5760
5861EXAMPLES = '''
@@ -186,14 +189,19 @@ def send_annotation(self, annotation):
186189
187190class Annotation (object ):
188191
189- def __init__ (self , text , tags , tstamp = None , end_tstamp = None ):
192+ def __init__ (self , text , tags , tstamp = None , end_tstamp = None ,
193+ dashboard_id = None , panel_id = None ):
190194 self .text = text
191195 self .tags = tags
192196 self ._set_time (tstamp )
193197 self .isRegion = False
194198 if end_tstamp :
195199 self .timeEnd = int (end_tstamp ) * 1000
196200 self .isRegion = True
201+ if dashboard_id :
202+ self .dashboardId = dashboard_id
203+ if panel_id :
204+ self .panelId = panel_id
197205
198206 def _set_time (self , tstamp = None , end_tstamp = None ):
199207 if tstamp :
@@ -219,6 +227,8 @@ def main():
219227 end_tstamp = dict (required = False , default = None , type = 'int' ),
220228 tags = dict (required = False , default = [], type = 'list' ),
221229 text = dict (required = True , type = 'str' ),
230+ dashboard_id = dict (required = False , type = 'int' , default = None ),
231+ panel_id = dict (required = False , type = 'int' , default = None )
222232 )
223233 module = AnsibleModule (
224234 argument_spec = base_arg_spec ,
@@ -234,8 +244,11 @@ def main():
234244 end_tstamp = module .params ['end_tstamp' ]
235245 tags = ["ansible" ] + module .params ['tags' ]
236246 text = module .params ['text' ]
247+ dashboard_id = module .params ['dashboard_id' ]
248+ panel_id = module .params ['panel_id' ]
237249
238- annotation = Annotation (text , tags , tstamp = tstamp , end_tstamp = end_tstamp )
250+ annotation = Annotation (text , tags , tstamp = tstamp , end_tstamp = end_tstamp ,
251+ dashboard_id = dashboard_id , panel_id = panel_id )
239252
240253 grafana = GrafanaManager (module , url , url_username , url_password , token )
241254
0 commit comments