SonarQube version : * Enterprise Edition * Version 7.9.1 (build 27448)
What I am trying to achieve : I am trying to create sonar project using Ansible.
task definition :
- name: Create a sonar project
uri:
url: “http://sonardashboard.orgname.com/api/projects/create”
method: POST
user: “{{ git_username }}”
password: “{{ git_password }}”
validate_certs: no
return_content: yes
force_basic_auth: yes
body: “{{ lookup(‘template’,‘Project.j2’) | to_json }}”
body_format: json
status_code: 201
retries: 3
delay: 1
with_items:- “{{ app_name }}”
Project.j2 :
{
“name”: “{{ item.Project }}-{{ item.name }}”,
“project”: “Testing:{{ item.name }}”,
“visibility”: “private”
}
Error :
failed: [localhost] (item={u’name’: u’hello-world’, u’Project’: u’test-project’}) => {“changed”: false, “connection”: “close”, “content”: “{“errors”:[{“msg”:“The ‘project’ parameter is missing”}]}”, “content_length”: “57”, “content_type”: “application/json”, “date”: “Sat, 25 Apr 2020 12:19:00 GMT”, “item”: {“Project”: “test-project”, “name”: “hello-world”}, “json”: {“errors”: [{“msg”: “The ‘project’ parameter is missing”}]}, “msg”: "Status code was 400 and not [201]: HTTP Error 400: ", “redirected”: false, “status”: 400, “url”: “http://sonardashboard.orgname.com/api/projects/create”}
to retry, use: --limit @/tmp/workspace/Configuration-Management/Ansible_Run/sonar.retry