Hello I’m trying to edit a jira issue but I receive 404 I don’t know why
I think that could be because the field hosts is required, but I don’t have ssh to the server and I put other host just to pass.
Any ideia?
Hello I’m trying to edit a jira issue but I receive 404 I don’t know why
I think that could be because the field hosts is required, but I don’t have ssh to the server and I put other host just to pass.
Any ideia?
do you mean the inventory? just change the group in hosts to localhost. In this case you are not ssh to the jira server but, sending api calls.
Thanks a lot for the quickly reply.
So I change in my hosts:
[local]
localhost
and in my playbook:
probably need connection: local or delagate_to: localhost in the playbook
Or just use ‘implicit localhost’ - https://docs.ansible.com/ansible/latest/inventory/implicit_localhost.html.
I don’t know why the Jira module it’s not working.
IT’S WORKS!!!
[root@bd9fb0ef9526 playbooks]# curl -u rodrigo:q0y6S3lwmxlHbMYckmA6AF -X POST -d @data.json -H “Content-Type: application/json” “https://myjira.atlassian.net/rest/api/3/issue”
{“id”:“425566”,“key”:“VFNCDS-1442”,“self”:“https://myjira.atlassian.net/rest/api/3/issue/425566”}
data.json:
{
“fields”: {
“project”:
{
“key”: “VFNCDS”
},
“summary”: “REST EXAMPLE2”,
“issuetype”: {
“name”: “Task”
}
}
}
IT’S NOT WORKS!!!
[root@bd9fb0ef9526 playbooks]# ansible-playbook create_issue.yml
PLAY [clients] ******************************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************************
ok: [172.17.0.4]
TASK [Create an issue] **********************************************************************************************************************************************************************************************************************
fatal: [172.17.0.4]: FAILED! => {“changed”: false, “msg”: "HTTP Error 400: "}
to retry, use: --limit @/etc/ansible/playbooks/create_issue.retry
PLAY RECAP **********************************************************************************************************************************************************************************************************************************
172.17.0.4 : ok=1 changed=0 unreachable=0 failed=1
create_issue.yml
Try running your playbook with -vvvvvv
It’s been a while but I had some trouble with the jira module (and also running via python 2) so in the end I switched to using the ‘uri’ module for some things and running any playbooks that interact with jira using python 3.
I forget the exact issue but I couldn’t establish a connection from a python 2.
If you can’t run all your playbooks with python 3 yet then you can choose to run a playbook using python3 like this:
ansible-playbook sample-playbook.yml -e 'ansible_python_interpreter=/usr/bin/python3'
(as described here: https://docs.ansible.com/ansible/latest/reference_appendices/python_3_support.html)
Hope this helps,
Jon