Ramesh_AR
(Ramesh AR)
January 14, 2021, 12:07am
1
Hi,
I have a playbook to retrieve user details and getting the output by using debug module. on same playbook second task to comment the user details in JIRA ticket.
any idea how to redirect the debug output to jira module .
debug:
msg: “{{ user | list | to_yaml }}”
name: Commenting output to Jira
hosts: 127.0.0.1
connection: local
tasks:
name: Comment on issue
jira:
uri: ‘https://xxxxx ’
username: ‘xxxx’
password: ‘xxxx’
issue: ‘xxxx’
operation: comment
comment: “{{ user | list | to_yaml }}” >>> i tried this way but didn’t work
delegate_to: localhost
Thank you,
Ramesh
What does that “user” variable look like?
What does “didn’t work” mean exactly?
Akasurde
(Abhijeet Kasurde)
January 14, 2021, 8:18am
3
Are you getting error messages? I am able to process the comment
name: Comment an issue
community.general.jira:
uri: ‘{{ jirauri }}’
username: ‘{{ jira_username }}’
password: “{{ lookup(‘file’, ‘/Users/akasurde/.jira_api_token’) }}”
project: scrum-project
operation: comment
issue: “SP-1”
comment: “In Progress”
register: issue_comment
debug:
msg: “{{ issue_comment }}”
“meta”: {
“author”: {
“accountId”: “557079:f1799ad8-ab63-413a-a052-4e0cb738dfa9”,
“accountType”: “atlassian”,
“active”: true,
“avatarUrls”: {},
“displayName”: “Aab”,
“emailAddress”: “xxx@gmail.com ”,
“self”: “https://ansi.atlassian.net/rest/api/2/user?accountId=557058%3Af1799ad8-ab63-413a-a052-4e0cb738dfa9 ”,
“timeZone”: “Asia/Kolkata”
},
“body”: “In Progress”,
“created”: “2021-01-14T13:44:12.521+0530”,
“id”: “10000”,
“jsdPublic”: true,
“self”: “https://ansi.atlassian.net/rest/api/2/issue/10000/comment/10000 ”,
“updateAuthor”: {
“accountId”: “557079:f1799ad8-ab63-413a-a052-4e0cb738dfa9”,
“accountType”: “atlassian”,
“active”: true,
“avatarUrls”: {
},
“displayName”: “aab”,
“emailAddress”: “xxx@gmail.com ”,
“self”: “https://ansi.atlassian.net/rest/api/2/user?accountId=557058%3Af1799ad8-ab63-413a-a052-4e0cb738dfa9 ”,
“timeZone”: “Asia/Kolkata”
}
}
Ramesh_AR
(Ramesh AR)
January 14, 2021, 6:26pm
4
HI Dick / Abhijeet,
I want to pass the below variable data’s to Jira comment section .
TASK [debug] *************************************************************************************************************************************
ok: [test1] => {}
MSG:
{accountStatus: active, id: ‘1’, name: admin, priv: admin}
{accountStatus: active, id: ‘2’, name: VE, priv: admin}
{accountStatus: active, id: ‘3’, name: RIOR, priv: admin}
{accountStatus: active, id: ‘4’, name: VPIO, priv: admin}
{accountStatus: active, id: ‘5’, name: vie, priv: admin}
{accountStatus: active, id: ‘6’, name: p5work, priv: admin}
{accountStatus: active, id: ‘7’, name: DEU, priv: admin}
Ramesh_AR
(Ramesh AR)
January 14, 2021, 8:35pm
5
I’m able to comment the debug output but there’s no host/IP details… is there any way to take and comment as well . ?
Now : commenting below format,
{accountStatus: active, id: ‘1’, name: admin, priv: admin}
{accountStatus: active, id: ‘2’, name: VE, priv: admin}
{accountStatus: active, id: ‘3’, name: RIOR, priv: admin}
{accountStatus: active, id: ‘4’, name: VPIO, priv: admin}
{accountStatus: active, id: ‘5’, name: vie, priv: admin}
{accountStatus: active, id: ‘6’, name: p5work, priv: admin}
{accountStatus: active, id: ‘7’, name: DEU, priv: admin}
expecting comment : should be with hostname / IP address
ok: [test1] => {}
MSG:
{accountStatus: active, id: ‘1’, name: admin, priv: admin}
{accountStatus: active, id: ‘2’, name: VE, priv: admin}
{accountStatus: active, id: ‘3’, name: RIOR, priv: admin}
{accountStatus: active, id: ‘4’, name: VPIO, priv: admin}
{accountStatus: active, id: ‘5’, name: vie, priv: admin}
{accountStatus: active, id: ‘6’, name: p5work, priv: admin}
{accountStatus: active, id: ‘7’, name: DEU, priv: admin}
Correct. You didn’t mention that at all, nor how that data looks like, nor where it comes from.
Ramesh_AR
(Ramesh AR)
January 14, 2021, 11:05pm
7
Hi Dick,
Sure, Let me provide complete playbook .