Hi all
I started using the API v2 to create an ansible playbook to update a Jail (with my network setup out of strange reasons that requires some reconfiguration before and after the update).
Now I have issues starting up the Jail again after the update, maybe it is just me ...
If I do:
The API call is good, but the Jail is not started.
According to the swagger documentation although the body should just be a string.
But if I just pass a string I receive an error:
Can it be that this API is not working properly?
As well odd is that the stop structure is like I did it in the first try.
Thanks for your help, and sorry if it is just me not catching my own fault.
BR sebi
I started using the API v2 to create an ansible playbook to update a Jail (with my network setup out of strange reasons that requires some reconfiguration before and after the update).
Now I have issues starting up the Jail again after the update, maybe it is just me ...
If I do:
Code:
vars: freenas_apitoken: "{{ api_token }}" freenas_host: "{{ ansible_host }}" freenas_api_url: "{{ freenas_url + '/api/v2.0' }}" jail: "scarif" target_jail: jail: "{{ jail }}" - name: iocage | Start Jail uri: body: "{{ target_jail }}" body_format: json method: POST headers: Authorization: 'Bearer {{ freenas_apitoken }}' return_content: true status_code: 200 url: "{{ freenas_api_url + '/jail/start' }}" validate_certs: no delegate_to: localhost
The API call is good, but the Jail is not started.
According to the swagger documentation although the body should just be a string.
But if I just pass a string I receive an error:
Code:
fatal: [10.0.0.1]: FAILED! => { "changed": false, "connection": "close", "content": "{\"message\": \"Expecting value: line 1 column 1 (char 0)\"}", "content_length": "56", "content_type": "text/plain; charset=utf-8", "date": "Wed, 17 Nov 2021 21:43:12 GMT", "elapsed": 0, "invocation": { "module_args": { "attributes": null, "backup": null, "body": "scarif", "body_format": "json", "client_cert": null, "client_key": null, "content": null, "creates": null, "delimiter": null, "dest": null, "directory_mode": null, "follow": false, "follow_redirects": "safe", "force": false, "force_basic_auth": false, "group": null, "headers": { "Authorization": "Bearer xxx", "Content-Type": "application/json" }, "http_agent": "ansible-httpget", "method": "POST", "mode": null, "owner": null, "regexp": null, "remote_src": null, "removes": null, "return_content": true, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": null, "status_code": [ "200" ], "timeout": 30, "unix_socket": null, "unsafe_writes": null, "url": "https://10.0.0.1/api/v2.0/jail/start", "url_password": null, "url_username": null, "use_proxy": true, "validate_certs": false } }, "json": { "message": "Expecting value: line 1 column 1 (char 0)" }, "msg": "Status code was 400 and not [200]: HTTP Error 400: Bad Request", "redirected": false, "server": "nginx", "status": 400, "url": "https://10.0.0.1/api/v2.0/jail/start" }
Can it be that this API is not working properly?
As well odd is that the stop structure is like I did it in the first try.
Thanks for your help, and sorry if it is just me not catching my own fault.
BR sebi