Use of ansible module input parameters in subsequent tasks

Hi,

I want to use region attribute from below task for subsequent task but that attribute is not a part of output , so how I can use it next tasks.

  • name: get aws vpc detailsec2_vpc_net_info:
    aws_access_key: ##########
    aws_secret_key: #########
    region: us-east-1
    register: aws_output

Region is input to the given module so I want to print that region. Please guide me how to print region its not a part of register. Thank you.

You can create a temporary variable to store both region and register value and then access that in subsequent tasks.

For example,

vars:
vpcs:

tasks:

  • name: Update register variable
    set_fact:
    new_vpcs: “{{ vpcs | combine({‘region’: ‘us-east-1’ }) }}”