Использование зарегистрированной переменной в ansible после удаления одинарных кавычек
После регистрации результата задачи, когда я отлаживаю переменную. Значение, которое я получаю в двойных кавычках, как"1234"
, Если я использую в другом модуле или ANSIBLE задачу, он становится[u'1234']
.
Я удалил символ u и скобки с помощью замены.
Как избавиться от одинарных кавычек по умолчанию.
Actual output : '1234'
expected output: 1234
Фрагмент пьесы
- uri:
url: http://test/ws?Id=4a3d
method: GET
content_as_json: yes
password: admin
user: admin
validate_certs: no
return_content: yes
HEADER_Cookie: "{{login.set_cookie}}"
register: name
- debug: msg="{{ name.content | regex_findall('name=\"(\d+)\"') }}"
register: test
- uri:
url: "http://test/ws?name={{test.msg | replace('u','') | replace('[','') | replace(']','')}}"
method: GET
content_as_json: true
password: admin
user: admin
validate_certs: no
return_content: yes
HEADER_Cookie: "{{login.set_cookie}}"
я использовалint
также, но это вернуло 0.
{{test.msg | replace('u','') | replace('[','') | replace(']','') | int}}
Выход модуля URI:
"<listResponse type=\"cust\" count=\"1\"><instance name=\"1234\" id=\"abcd\" customerRefId=\"xyz\" refId1=\"2345\" type=\"org\" enabled=\"true\" phone=\"\" fax=\"\" billingZip=\"\" billingAddress=\"\" billingCity=\"\" billingCountry=\"\" billingState=\"\" vendorId=\"1\" defaultEmail=\"pqr\" defaultContactName=\"wer\"/></listResponse>"