I am registering the output of an operation and then applying the filter to display the value .But i also want to register that displayed value as a variable. I am not able to register that as a variable. Does anyone knows the solution to this ?
Here is my playbook
---
- name: Filtering output to register in a variable
hosts: localhost
gather_facts: no
tasks:
- name: register filtered output to a variable
uri:
url: https://example.com/api/id
method: GET
user: administrator
password: password
force_basic_auth: yes
validate_certs: no
register: restdata
- name: Display the output
debug: msg="{{ restdata.json.parameter[1] }}"
I was wondering. Wouldn't it be simpler. If we filter the output first and then register it as a variable? does anyone know how to do that ?