如何在ansible上显示相同的curl输出?

时间:2017-09-29 05:39:59

标签: rest curl ansible

我有oracle企业管理器IaaS的curl(和rest api)命令,并希望在对相同请求(http get)使用ansible时生成相同的输出。在我的测试环境中,但是ansible没有显示正确的输出。请参阅我的测试脚本和输出,任何评论将非常感谢。

## curl --insecure -X GET -u osc_anz_admin:welcome1 myurl_here
{
  "uri" : "/em/cloud/iaas/server/byrequest/142" ,
  "status" : "DELETED" ,
  "canonicalLink" : "/em/websvcs/restful/extws/cloudservices/service/v0/ssa/em/cloud/iaas/server/byrequest/142"
}
## cat showvmstatus.yml
---
- hosts: localhost
  tasks:
  - name: show vm status
    uri:
      url: myurl_here
      method: GET
      return_contents: yes
      user: osc_anz_admin
      password: welcome1
      validate_certs: no
      force_basic_auth: yes
    register: showvmstatus
  - name: show list
    debug: var=showvmstatus
## ansible-playbook showvmstatus.yml 

PLAY [localhost] *************************************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************************************
ok: [localhost]

TASK [show vm status] ********************************************************************************************************************************************************
ok: [localhost]

TASK [show list] *************************************************************************************************************************************************************
ok: [localhost] => {
    "showvmstatus": {
        "changed": false, 
        "connection": "close", 
        "content_language": "en,en-us", 
        "content_type": "application/oracle.com.cloud.common.VM+json; charset=utf-8", 
        "date": "Fri, 29 Sep 2017 05:22:06 GMT", 
        "location": "https://em13-test.gdn.aus.osc:7803?status,uri/em/cloud/iaas/server/byrequest/142", 
        "msg": "OK (unknown bytes)", 
        "redirected": false, 
        "server": "Oracle-HTTP-Server-12c", 
        "set_cookie": "ORA_SMP_EM_AUTH_-2918986201179331800=7oDMFbBgPTaoYai-V8wrdJcyMIfzMxomyg3XKocxrlRRx49cYn-z!-989316618; path=/em; secure; HttpOnly", 
        "status": 200, 
        "transfer_encoding": "chunked", 
        "url": "https://em13-test.gdn.aus.osc:7803/em/cloud/iaas/server/byrequest/142?status,uri", 
        "x_oracle_dms_ecid": "005M^oohrB28pmNMuIQ5UH00014L0002Z^", 
        "x_orcl_emoa": "true", 
        "x_specification_version": "10001"
    }
}

PLAY RECAP *******************************************************************************************************************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0   
## 

如上所示,根据ansible输出,根本没有显示vm详细信息。

1 个答案:

答案 0 :(得分:0)

import React from 'react'; export default class App extends React.Component { render(){ return( <div> <h1> the list </h1> </div> ) } } 中有拼写错误 - 应为return_contents: yes