community / community.general / 0.1.1 / module / jira create and modify issues in a JIRA instance Authors: Steve Smith (@tarka) preview | supported by communitycommunity.general.jira (0.1.1) — module
Install with ansible-galaxy collection install community.general:==0.1.1
collections: - name: community.general version: 0.1.1
Create and modify issues in a JIRA instance.
# Create a new issue and add a comment to it: - name: Create an issue jira: uri: '{{ server }}' username: '{{ user }}' password: '{{ pass }}' project: ANS operation: create summary: Example Issue description: Created using Ansible issuetype: Task register: issue
- name: Comment on issue jira: uri: '{{ server }}' username: '{{ user }}' password: '{{ pass }}' issue: '{{ issue.meta.key }}' operation: comment comment: A comment added by Ansible
# Assign an existing issue using edit - name: Assign an issue using free-form fields jira: uri: '{{ server }}' username: '{{ user }}' password: '{{ pass }}' issue: '{{ issue.meta.key}}' operation: edit assignee: ssmith
# Create an issue with an existing assignee - name: Create an assigned issue jira: uri: '{{ server }}' username: '{{ user }}' password: '{{ pass }}' project: ANS operation: create summary: Assigned issue description: Created and assigned using Ansible issuetype: Task assignee: ssmith
# Edit an issue - name: Set the labels on an issue using free-form fields jira: uri: '{{ server }}' username: '{{ user }}' password: '{{ pass }}' issue: '{{ issue.meta.key }}' operation: edit args: fields: labels: - autocreated - ansible
# Retrieve metadata for an issue and use it to create an account - name: Get an issue jira: uri: '{{ server }}' username: '{{ user }}' password: '{{ pass }}' project: ANS operation: fetch issue: ANS-63 register: issue
- name: Create a unix account for the reporter become: true user: name: '{{ issue.meta.fields.creator.name }}' comment: '{{ issue.meta.fields.creator.displayName }}'
# You can get list of valid linktypes at /rest/api/2/issueLinkType # url of your jira installation. - name: Create link from HSP-1 to MKY-1 jira: uri: '{{ server }}' username: '{{ user }}' password: '{{ pass }}' operation: link linktype: Relates inwardissue: HSP-1 outwardissue: MKY-1
# Transition an issue by target status - name: Close the issue jira: uri: '{{ server }}' username: '{{ user }}' password: '{{ pass }}' issue: '{{ issue.meta.key }}' operation: transition status: Done
uri: description: - Base URI for the JIRA instance. required: true issue: description: - An existing issue key to operate on. required: false fields: description: - This is a free-form data structure that can contain arbitrary data. This is passed directly to the JIRA REST API (possibly after merging with other required data, as when passed to create). See examples for more information, and the JIRA REST API for the structure required for various fields. required: false status: description: - The desired status; only relevant for the transition operation. required: false comment: description: - The comment text to add. required: false project: description: - The project for this operation. Required for issue creation. required: false summary: description: - The issue summary, where appropriate. required: false timeout: default: 10 description: - Set timeout, in seconds, on requests to JIRA API. required: false assignee: description: - Sets the assignee on create or transition operations. Note not all transitions will allow this. required: false linktype: description: - Set type of link, when action 'link' selected. required: false password: description: - The password to log-in with. required: true username: description: - The username to log-in with. required: true issuetype: description: - The issue type, for issue creation. required: false operation: aliases: - command choices: - create - comment - edit - fetch - transition - link description: - The operation to perform. required: true description: description: - The issue description, where appropriate. required: false inwardissue: description: - Set issue from which link will be created. required: false outwardissue: description: - Set issue to which link will be created. required: false validate_certs: default: true description: - Require valid SSL certificates (set to `false` if you'd like to use self-signed certificates) required: false type: bool