Kai,

Thanks for your all support. :)

You were right it was just displaying access details on the screen. When I 
started putting them in a YAML file, I was just getting what I needed.

I have created three Ansible Roles and uploaded them to 
https://github.com/Bhavin-P/Ansible
Role 1. To add, format and mount extra EBS volume to the given list of EC2 
IDs.
Role 2. To take a snapshot of root volumes, it can be scheduled cron.
Role 3. To restore root volume, from the snapshot taken by Role 2.

Thanks to you and community as well, for providing the platform.

Thanks and regards,
Bhavin Parmar.

On Thursday, March 23, 2017 at 9:26:16 PM UTC+5:30, Kai Stian Olstad wrote:
>
> On 23. mars 2017 13:44, Bhavin Parmar wrote: 
> > Hey Kai, 
> > 
> > Thanks for your guidance. I am just looking for vol-0e0516ea962XXXXX as 
> > output. Same way I have to grab various parts from output, to convert 
> them 
> > in key : value pair, to store in YAML file. 
> > 
> > Please, can you suggest how to only get the particular part? Like we can 
> > get with following manual  way? 
> > 
> >    - debug: var=ec2_snap.results[0].invocation.module_args.device_name 
> >    - debug: var=ec2_snap.results[0].item 
> >    - debug: var=ec2_snap.results[0].volume_id 
> >    - debug: var=ec2_snap.results[0].snapshot_id 
> >    - debug: var=ec2_snap.results[1].invocation.module_args.device_name 
> >    - debug: var=ec2_snap.results[1].item 
> >    - debug: var=ec2_snap.results[1].volume_id 
> >    - debug: var=ec2_snap.results[1].snapshot_id 
>
> I'm not sure what you mean, because your loop did that. 
> The output on the screen will always contain more than just the value, 
> but the variable itself contains just the value. 
>
> - name: Print out variables in a loop with debug module 
>    debug: msg="### The output ###: {{ 
> item.invocation.module_args.device_name }} - {{ item.item }} - {{ 
> item.volume_id }} - {{ item.snapshot_id }}" 
>    with_items: "{{ ec2_snap.results }}" 
>
> This will print the values on one line divided by dash. 
> And it would be easy to identify since the line start with "### The 
> output ###:" 
>
> -- 
> Kai Stian Olstad 
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/97f52b33-0456-4b18-9646-167533e39b4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to