jira - create and modify issues in a JIRA instance

Author:Steve Smith

Synopsis

New in version 1.6.

Create and modify issues in a JIRA instance.

Options

parameter required default choices comments
assignee no
    Sets the assignee on create or transition operations. Note not all transitions will allow this.
    comment no
      The comment text to add.
      description no
        The issue description, where appropriate.
        fields no
          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.
          issue no
            An existing issue key to operate on.
            issuetype no
              The issue type, for issue creation.
              operation yes
              • create
              • comment
              • edit
              • fetch
              • transition
              The operation to perform.
              password yes
                The password to log-in with.
                project no
                  The project for this operation. Required for issue creation.
                  status no
                    The desired status; only relevant for the transition operation.
                    summary no
                      The issue summary, where appropriate.
                      uri yes
                        Base URI for the JIRA instance
                        username yes
                          The username to log-in with.

                          Examples


                          # 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 using free-form fields
                          - 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"]}}
                          
                          - name: Set the labels on an issue, YAML version
                            jira: uri={{server}} username={{user}} password={{pass}}
                                  issue={{issue.meta.key}} operation=edit
                            args:
                              fields:
                                labels:
                                  - "autocreated"
                                  - "ansible"
                                  - "yaml"
                          
                          # 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
                            sudo: true
                            user: name="{{issue.meta.fields.creator.name}}" comment="{{issue.meta.fields.creator.displayName}}"
                          
                          # 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"
                          

                          Note

                          Currently this only works with basic-auth.