Use of ansible module input parameters in subsequent tasks

10 views
Skip to first unread message

Akshay Jadhav

unread,
Jul 11, 2022, 4:21:53 AM7/11/22
to Ansible Project

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 details 
  ec2_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.

Abhijeet Kasurde

unread,
Jul 11, 2022, 4:33:43 AM7/11/22
to ansible...@googlegroups.com
You can create a temporary variable to store both region and register value and then access that in subsequent tasks.

For example,
...
  vars:
    vpcs:
        a: 1
...
  tasks:
    - name: Update register variable
      set_fact:
        new_vpcs: "{{ vpcs | combine({'region': 'us-east-1' }) }}"

...


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/33d5febb-bfcf-4a4f-8046-e38b45ca04c6n%40googlegroups.com.


--
Thanks,
Abhijeet Kasurde
Reply all
Reply to author
Forward
0 new messages