私のタスクは、出力は私が何をしたいのかAnsibleのUnicodeオブジェクトは
{
"router_id": null,
"status": "DOWN",
"description": "",
"created_at": "2017-05-24T10:49:15Z",
"updated_at": "2017-05-24T10:49:15Z",
"floating_network_id": "923-cc77237b08e7",
"headers": "",
"fixed_ip_address": null,
"floating_ip_address": "192.*.*.*",
"revision_number": 1,
"project_id": "2709ad381fcf41c5bce673c916fded10",
"port_id": null,
"id": "c5d187elg-d269-4eae-b6ae-7d258f04983"
}
でJSON形式の下になります
- name: task name
shell: openstack floating ip create provider --format json
register: result
での構文解析なし、属性値のJSONはfloating_ip_addressや店舗を取得し、あるいません私は別のタスクでそれを使用することができるようにそれを変数に変換します。
イム
、
- set_fact:
address: "{{ (result.stdout | from_json | selectattr('floating_ip_address') | list | first).floating_ip_address }}"
をこれを行うために、以下のコードを使用して、しかし、イムは
"ERROR! 'unicode object' has no attribute 'floating_ip_address'"
エラーを取得してIPアドレスのみを取得するための正しいフォーマットは何ですか?
雅sure..I'llは私が –