9191 description:
9292 - Sets the assignee on create or transition operations. Note not all transitions will allow this.
9393
94+ linktype:
95+ required: false
96+ version_added: 2.3
97+ description:
98+ - Set type of link, when action 'link' selected
99+
100+ inwardissue:
101+ required: false
102+ version_added: 2.3
103+ description:
104+ - set issue from which link will be created
105+
106+ outwardissue:
107+ required: false
108+ version_added: 2.3
109+ description:
110+ - set issue to which link will be created
111+
94112 fields:
95113 required: false
96114 description:
179197 name: '{{ issue.meta.fields.creator.name }}'
180198 comment: '{{issue.meta.fields.creator.displayName }}'
181199
200+ - name: Create link from HSP-1 to MKY-1
201+ jira: uri={{server}} username={{user}} password={{pass}} operation=link
202+ linktype=Relate inwardissue=HSP-1 outwardissue=MKY-1
203+
182204# Transition an issue by target status
183205- name: Close the issue
184206 jira:
@@ -315,21 +337,34 @@ def transition(restbase, user, passwd, params):
315337
316338 return ret
317339
340+ def link (restbase , user , passwd , params ):
341+ data = {
342+ 'type' : { 'name' : params ['linktype' ] },
343+ 'inwardIssue' : { 'key' : params ['inwardissue' ] },
344+ 'outwardIssue' : { 'key' : params ['outwardissue' ] },
345+ }
346+
347+ url = restbase + '/issueLink/'
348+
349+ ret = post (url , user , passwd , data )
350+
351+ return ret
318352
319353# Some parameters are required depending on the operation:
320354OP_REQUIRED = dict (create = ['project' , 'issuetype' , 'summary' , 'description' ],
321355 comment = ['issue' , 'comment' ],
322356 edit = [],
323357 fetch = ['issue' ],
324- transition = ['status' ])
358+ transition = ['status' ],
359+ link = ['linktype' , 'inwardissue' , 'outwardissue' ])
325360
326361def main ():
327362
328363 global module
329364 module = AnsibleModule (
330365 argument_spec = dict (
331366 uri = dict (required = True ),
332- operation = dict (choices = ['create' , 'comment' , 'edit' , 'fetch' , 'transition' ],
367+ operation = dict (choices = ['create' , 'comment' , 'edit' , 'fetch' , 'transition' , 'link' ],
333368 aliases = ['command' ], required = True ),
334369 username = dict (required = True ),
335370 password = dict (required = True ),
@@ -341,7 +376,10 @@ def main():
341376 comment = dict (),
342377 status = dict (),
343378 assignee = dict (),
344- fields = dict (default = {}, type = 'dict' )
379+ fields = dict (default = {}, type = 'dict' ),
380+ linktype = dict (),
381+ inwardissue = dict (),
382+ outwardissue = dict (),
345383 ),
346384 supports_check_mode = False
347385 )
0 commit comments