cancel
Showing results for 
Search instead for 
Did you mean: 
  • 2,281 Views

Convert string to integer in json

I need to pass 2  variables CONTAINER_SIGCARDID  and SIGNALINGCARDTYPE , expected output is 18 and 52 but i am getting "18" and "52".

 

Tried all the suggessions like using |int and so on but no luck. Can anybody help me here

 

url: 'http://localhost:8081/cms/config?v=1621614330906'
method: POST
headers:
Connection: 'keep-alive'
validate_certs: no
body:
context: MICROSVC_CONTAINERCONFIG
action: MICROSVC_CONTAINERCONFIG_CONFIGURE
actionObject:
- CONTAINER_SIGCARDID: "{{ CONTAINER_SIGCARDID }}"
IPADDRESS: "{{IPADDRESS}}"
SIGNALINGCARDTYPE: "{{ SIGNALINGCARDTYPE }}"
STATUS: 0
IMAGE: rhel74_platform/rhel74_egls:R11
ROUTES: 10.0.0.0/24#10.1.0.1#eth1
INTERFACE: dp#1160#eth1#172.17.42.12/24,dp#1161#eth2#172.17.43.11/24@192.178.127.1,dp#1162#eth3#172.17.44.11/24
SIGNALINGCARD_NAME: "{{SIGNALINGCARD_NAME}}"
PTTSERVERID: "{{PTTSERVERID}}"
CPU_SET_CPUS:
SYNCGWREP_SYNCGWFUNC_FLAG: 0
object:
dgId: '005'
body_format: json

 

 

Body:

{"context":"MICROSVC_CONTAINERCONFIG","action":"MICROSVC_CONTAINERCONFIG_CONFIGURE","actionObject":[{"CONTAINER_SIGCARDID":"{{CONTAINER_SIGCARDID}}","IPADDRESS":"{{IPADDRESS}}","SIGNALINGCARDTYPE":"{{SIGNALINGCARDTYPE}}","STATUS":0,"IMAGE":"rhel74_platform/rhel74_egls:R11","ROUTES":"10.0.0.0/24#10.1.0.1#eth1","INTERFACE":"dp#1160#eth1#172.17.42.12/24,dp#1161#eth2#172.17.43.11/24@192.178.127.1,dp#1162#eth3#172.17.44.11/24","SIGNALINGCARD_NAME":"{{SIGNALINGCARD_NAME}}","PTTSERVERID":"PTTSERVERID","CPU_SET_CPUS":null,"SYNCGWREP_SYNCGWFUNC_FLAG":0}],"object":{"dgId":"001"}}

Labels (1)
0 Kudos
2 Replies
andkra
Flight Engineer Flight Engineer
Flight Engineer
  • 2,152 Views

Where do you define the two variables?

If you use "ansible-playbook -e " use the json notation to define your variables.

ansible-playbook -e '{"CONTAINER_SIGCARDID": 18}' ...

Also try:

CONTAINER_SIGCARDID: "{{ CONTAINER_SIGCARDID | int }}"

 

Best regards
Andreas

0 Kudos
  • 2,147 Views

Basically these variables are output from one more api
0 Kudos
Join the discussion
You must log in to join this conversation.