Я хочу выполнить эту команду curl:
shell: 'curl -X POST -F app.yaml=@/full/path/to/app.yaml -H "Content-Type: multipart/form-data" http://endpoint:8080/v2/apps'
На основе: Выполнить curl -X с записной книжкой , я сделал
- name:
uri:
url: "https://endpoint:8080/v2/apps"
method: "POST"
body: "{{ 'app.yaml=@' + lookup('file','/full/path/to/app.yaml') }}"
headers:
content-Type: "multipart/form-data"
status_code: 200
validate_certs: no
return_content: yes
Но яполучил: "отсутствует app.yaml" как с помощью модуля поиска или полный путь.Я сделал свои тесты на моей машине контроллера.
Using module file /usr/lib/python2.7/site-packages/ansible/modules/net_tools/basics/uri.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: paas
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python2 && sleep 0'
The full traceback is:
File "/tmp/ansible_HDPF5B/ansible_module_uri.py", line 535, in main
js = json.loads(u_content)
File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
fatal: [localhost]: FAILED! => {
"cache_control": "no-cache, no-store, no-transform, must-revalidate, proxy-revalidate, max-age=0, s-maxage=0",
"changed": false,
"connection": "close",
"content": "missing app.yaml",
"content_type": "text/plain",
"invocation": {
"module_args": {
"body": "app.yaml=@/tmp/app.yaml",
"body_format": "raw",
"headers": {
"Authorization": "Token XXX",
"content-Type": "multipart/form-data"
},
"http_agent": "ansible-httpget",
"method": "POST",
"return_content": true,
"status_code": [
"200"
],
"url": "https://endpoint:8080/v2/apps",
"use_proxy": true,
"validate_certs": false
}
},
"pragma": "no-cache",
"redirected": false,
"server": "nginx",
"status": 404,
"url": "https://endpoint:8080/v2/apps",
"x_api_version": "1.1.4"
}
MSG:
Status code was 404 and not [200]: HTTP Error 404: Not Found
Кто-нибудь может мне помочь?заранее спасибо.