-
name: Get media_server response
hosts: localhost
gather_facts: no
tasks:
-
name: Pushing the generated configuration file to Media Server (sfconnect)
shell: “curl -X PUT -H ‘Username: AWSSUsername1’ -H ‘Password: AWSSPassword1’ ‘https://sfconnect-q.attwifi.com/awss-services/rest/v1/media/rgnet/rxg_gateways?keepFileName=true’ -F ‘file=@/tmp/test_config_1.txt’”
args:
warn: no
register: mediasvr_resp
ignore_errors: true
-
name: debug the upgrade_response
debug:
var: mediasvr_resp
I tried to create a task for some playbook and response should be like this
-
ok: [localhost] => {
"msg": {
"changed": true,
"cmd": "curl -X PUT -H 'Username: AWSSUsername1' -H 'Password: AWSSPassword1' 'https://sfconnect-q.attwifi.com/awss-services/rest/v1/media/rgnet/rxg_gateways?keepFileName=true' -F 'file=@/tmp/test_config_1.txt'",
"delta": "0:00:00.076243",
"end": "2023-10-13 02:43:30.159288",
"failed": false,
"msg": "",
"rc": 0,
"start": "2023-10-13 02:43:30.083045",
"stderr": " % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r100 362 100 162 100 200 2571 3174 --:--:-- --:--:-- --:--:-- 5746",
"stderr_lines": [
" % Total % Received % Xferd Average Speed Time Time Time Current",
" Dload Upload Total Spent Left Speed",
"",
" 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0",
"100 362 100 162 100 200 2571 3174 --:--:-- --:--:-- --:--:-- 5746"
],
"stdout": "{\"fileName\": \"test_config_1.txt\", \"path\": \"/rgnet/rxg_gateways\", \"bytes\": \"5\", \"mimeType\": \"application/octet-stream\", \"modified\": \"Fri Oct 13 02:43:30 UTC 2023\"}",
"stdout_lines": [
"{\"fileName\": \"test_config_1.txt\", \"path\": \"/rgnet/rxg_gateways\", \"bytes\": \"5\", \"mimeType\": \"application/octet-stream\", \"modified\": \"Fri Oct 13 02:43:30 UTC 2023\"}"
]
}
}
but in my output I’m missing the fields in “stdout” I have to get those fields in my response then only successful or else no, and also I have to create one more task for this with below conditions
task2: update status to cmdb
if 200,201, - update as success
if 400,401 or job failure - dont update any to cmdb
if 500 or others - update as failure
Can someone help me it is bit urgent…