Get the value of secrets of AWS secrets manager in jinja template

I am running the following command:

aws secretsmanager get-secret-value --secret-id Sumo/****** | jq --raw-output ‘.SecretString’ | jq -r .access_id

which gives me an output for the access_id.

I need to use this access id as a value of a variable in jijna template for sumo installation, can anyone help me with this, I am trying to set the value in a file and use lookup for it, but it seems to be a layman way of doing it. It would be really appreciated, if anyone can suggest a better way of achieving this.

Thanks in advance!

lookup plugin pipe where you need it to or set the result in a variable with set_fact if you going to use it multiple times.