[ansible-project] debug msg ignore other results.

2020-01-13 Thread Jegan A
Hello Team,

 I am iterating register result using debug and loop but it prints 
other variable result as well how to ignore that one while printing value 
which I want Below is the sample results. Cloud you please help me on this 
issues. I just want to print value of 
"item.invocation.module_args.volume_id" and ignore other results.



- debug:
  msg: "{{ item.invocation.module_args.volume_id }}"
   register: unused_block
   with_items:  "{{result_1.results}}"
   when: item.volume_attachments | length == 0


debug result

TASK [debug] 
*
skipping: [localhost] => (item={'failed': False, 'ansible_loop_var': 
u'item', u'volume_attachments': [{u'chap_username': None, u'time_created': 
u'2019-12-26T09:38:51.785000+00:00', u'is_read_only': False, u'volume_id': 
u'', u'device': None, u'xxx', u'lifecycle_state': 
u'ATTACHED', u'availability_domain': u'xx', u'display_name': 
u'volumeattachment20191226093851', u'compartment_id': 
u'', u'port': 3260, u'instance_id': 
u'x', u'iqn': u'x', 
u'is_pv_encryption_in_transit_enabled': False, u'attachment_type': 
u'iscsi', u'chap_secret': None, u'ipv4': u'169.254.2.2'}], 'item': 
u'xxx', u'invocation': {u'module_args': {u'auth_type': 
u'api_key', u'api_user_key_pass_phrase': None, u'availability_domain': 
None, u'display_name': None, u'config_profile_name': u'root', 
u'compartment_id': u'xxx', u'region': None, u'volume_id': 
u'xxx', u'instance_id': None, u'tenancy': None, 
u'api_user_key_file': None, u'api_user_fingerprint': None, u'api_user': 
None, 
u'config_file_location': u'~/.oci/config', u'volume_attachment_id': None}}, 
'changed': False, 'ansible_facts': {u'discovered_interpreter_python': 
u'/usr/bin/python'}})

ok: [localhost] => (item={'failed': False, 'ansible_loop_var': u'item', 
u'volume_attachments': [], 'item': u'', 
u'invocation': {u'module_args': {u'auth_type': u'api_key', 
u'api_user_key_pass_phrase': None, u'availability_domain': None, 
u'display_name': None, u'config_profile_name': u'root', u'compartment_id': 
u'xx', u'region': None, u'volume_id': 
u'xxx', u'instance_id': None, u'tenancy': 
None, u'api_user_key_file': None, u'api_user_fingerprint': None, 
u'api_user': None, u'config_file_location': u'~/.oci/config', 
u'volume_attachment_id': None}}, 'changed': False}) => {
"msg": "xx"
}


-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1642abc3-e997-4247-b250-fe0ee0aec82d%40googlegroups.com.


Re: [ansible-project] debug msg ignore other results.

2020-01-14 Thread James Cassell


On Tue, Jan 14, 2020, at 12:48 AM, Jegan A wrote:
> Hello Team,
> 
>  I am iterating register result using debug and loop but it prints 
> other variable result as well how to ignore that one while printing 
> value which I want Below is the sample results. Cloud you please help 
> me on this issues. I just want to print value of 
> "item.invocation.module_args.volume_id" and ignore other results.
> 
> 
> 
> - debug:
>  msg: "{{ item.invocation.module_args.volume_id }}"
>  register: unused_block
>  with_items: "{{result_1.results}}"
>  when: item.volume_attachments | length == 0
> 
> 
> debug result
> 
> TASK [debug] 
> *
> skipping: [localhost] => (item={'failed': False, 'ansible_loop_var': 
> u'item', u'volume_attachments': [{u'chap_username': None, 
> u'time_created': u'2019-12-26T09:38:51.785000+00:00', u'is_read_only': 
> False, u'volume_id': u'', u'device': None, u'xxx', 
> u'lifecycle_state': u'ATTACHED', u'availability_domain': u'xx', 
> u'display_name': u'volumeattachment20191226093851', u'compartment_id': 
> u'', u'port': 3260, u'instance_id': 
> u'x', u'iqn': u'x', 
> u'is_pv_encryption_in_transit_enabled': False, u'attachment_type': 
> u'iscsi', u'chap_secret': None, u'ipv4': u'169.254.2.2'}], 'item': 
> u'xxx', u'invocation': {u'module_args': 
> {u'auth_type': u'api_key', u'api_user_key_pass_phrase': None, 
> u'availability_domain': None, u'display_name': None, 
> u'config_profile_name': u'root', u'compartment_id': u'xxx', 
> u'region': None, u'volume_id': u'xxx', 
> u'instance_id': None, u'tenancy': None, u'api_user_key_file': None, 
> u'api_user_fingerprint': None, u'api_user': None, 
> u'config_file_location': u'~/.oci/config', u'volume_attachment_id': 
> None}}, 'changed': False, 'ansible_facts': 
> {u'discovered_interpreter_python': u'/usr/bin/python'}})
> 
> ok: [localhost] => (item={'failed': False, 'ansible_loop_var': u'item', 
> u'volume_attachments': [], 'item': u'', 
> u'invocation': {u'module_args': {u'auth_type': u'api_key', 
> u'api_user_key_pass_phrase': None, u'availability_domain': None, 
> u'display_name': None, u'config_profile_name': u'root', 
> u'compartment_id': u'xx', u'region': None, 
> u'volume_id': u'xxx', u'instance_id': 
> None, u'tenancy': None, u'api_user_key_file': None, 
> u'api_user_fingerprint': None, u'api_user': None, 
> u'config_file_location': u'~/.oci/config', u'volume_attachment_id': 
> None}}, 'changed': False}) => {
>  "msg": "xx"
> }
> 
> 

loop_control:
  label: "{{ item.invocation.module_args.volume_id }}"

Or similar.

V/r,
James Cassell

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6f8a4a0c-df9d-4b31-88e4-cf26b18c5a24%40www.fastmail.com.


Re: [ansible-project] debug msg ignore other results.

2020-01-14 Thread Jegan A
Thanks a lot. It is working for me.

On Tuesday, January 14, 2020 at 3:03:12 PM UTC+5:30, James Cassell wrote:
>
>
> On Tue, Jan 14, 2020, at 12:48 AM, Jegan A wrote: 
> > Hello Team, 
> > 
> >  I am iterating register result using debug and loop but it prints 
> > other variable result as well how to ignore that one while printing 
> > value which I want Below is the sample results. Cloud you please help 
> > me on this issues. I just want to print value of 
> > "item.invocation.module_args.volume_id" and ignore other results. 
> > 
> > 
> > 
> > - debug: 
> >  msg: "{{ item.invocation.module_args.volume_id }}" 
> >  register: unused_block 
> >  with_items: "{{result_1.results}}" 
> >  when: item.volume_attachments | length == 0 
> > 
> > 
> > debug result 
> > 
> > TASK [debug] 
> > 
> *
>  
>
> > skipping: [localhost] => (item={'failed': False, 'ansible_loop_var': 
> > u'item', u'volume_attachments': [{u'chap_username': None, 
> > u'time_created': u'2019-12-26T09:38:51.785000+00:00', u'is_read_only': 
> > False, u'volume_id': u'', u'device': None, u'xxx', 
> > u'lifecycle_state': u'ATTACHED', u'availability_domain': u'xx', 
> > u'display_name': u'volumeattachment20191226093851', u'compartment_id': 
> > u'', u'port': 3260, u'instance_id': 
> > u'x', u'iqn': u'x', 
> > u'is_pv_encryption_in_transit_enabled': False, u'attachment_type': 
> > u'iscsi', u'chap_secret': None, u'ipv4': u'169.254.2.2'}], 'item': 
> > u'xxx', u'invocation': {u'module_args': 
> > {u'auth_type': u'api_key', u'api_user_key_pass_phrase': None, 
> > u'availability_domain': None, u'display_name': None, 
> > u'config_profile_name': u'root', u'compartment_id': u'xxx', 
> > u'region': None, u'volume_id': u'xxx', 
> > u'instance_id': None, u'tenancy': None, u'api_user_key_file': None, 
> > u'api_user_fingerprint': None, u'api_user': None, 
> > u'config_file_location': u'~/.oci/config', u'volume_attachment_id': 
> > None}}, 'changed': False, 'ansible_facts': 
> > {u'discovered_interpreter_python': u'/usr/bin/python'}}) 
> > 
> > ok: [localhost] => (item={'failed': False, 'ansible_loop_var': u'item', 
> > u'volume_attachments': [], 'item': u'', 
> > u'invocation': {u'module_args': {u'auth_type': u'api_key', 
> > u'api_user_key_pass_phrase': None, u'availability_domain': None, 
> > u'display_name': None, u'config_profile_name': u'root', 
> > u'compartment_id': u'xx', u'region': None, 
> > u'volume_id': u'xxx', u'instance_id': 
> > None, u'tenancy': None, u'api_user_key_file': None, 
> > u'api_user_fingerprint': None, u'api_user': None, 
> > u'config_file_location': u'~/.oci/config', u'volume_attachment_id': 
> > None}}, 'changed': False}) => { 
> >  "msg": "xx" 
> > } 
> > 
> > 
>
> loop_control: 
>   label: "{{ item.invocation.module_args.volume_id }}" 
>
> Or similar. 
>
> V/r, 
> James Cassell 
>

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f46e6744-4e77-4f23-a5a0-51997c98932e%40googlegroups.com.


Re: [ansible-project] debug msg ignore other results.

2020-01-14 Thread alicia
For more details, see the section on “Adding controls to loops” here:

https://docs.ansible.com/ansible/devel/user_guide/playbooks_loops.html 




> On Jan 14, 2020, at 6:36 AM, Jegan A  wrote:
> 
> Thanks a lot. It is working for me.
> 
> On Tuesday, January 14, 2020 at 3:03:12 PM UTC+5:30, James Cassell wrote:
> 
> On Tue, Jan 14, 2020, at 12:48 AM, Jegan A wrote: 
> > Hello Team, 
> > 
> >  I am iterating register result using debug and loop but it prints 
> > other variable result as well how to ignore that one while printing 
> > value which I want Below is the sample results. Cloud you please help 
> > me on this issues. I just want to print value of 
> > "item.invocation.module_args.volume_id" and ignore other results. 
> > 
> > 
> > 
> > - debug: 
> >  msg: "{{ item.invocation.module_args.volume_id }}" 
> >  register: unused_block 
> >  with_items: "{{result_1.results}}" 
> >  when: item.volume_attachments | length == 0 
> > 
> > 
> > debug result 
> > 
> > TASK [debug] 
> > *
> >  
> > skipping: [localhost] => (item={'failed': False, 'ansible_loop_var': 
> > u'item', u'volume_attachments': [{u'chap_username': None, 
> > u'time_created': u'2019-12-26T09:38:51.785000+00:00', u'is_read_only': 
> > False, u'volume_id': u'', u'device': None, u'xxx', 
> > u'lifecycle_state': u'ATTACHED', u'availability_domain': u'xx', 
> > u'display_name': u'volumeattachment20191226093851', u'compartment_id': 
> > u'', u'port': 3260, u'instance_id': 
> > u'x', u'iqn': u'x', 
> > u'is_pv_encryption_in_transit_enabled': False, u'attachment_type': 
> > u'iscsi', u'chap_secret': None, u'ipv4': u'169.254.2.2'}], 'item': 
> > u'xxx', u'invocation': {u'module_args': 
> > {u'auth_type': u'api_key', u'api_user_key_pass_phrase': None, 
> > u'availability_domain': None, u'display_name': None, 
> > u'config_profile_name': u'root', u'compartment_id': u'xxx', 
> > u'region': None, u'volume_id': u'xxx', 
> > u'instance_id': None, u'tenancy': None, u'api_user_key_file': None, 
> > u'api_user_fingerprint': None, u'api_user': None, 
> > u'config_file_location': u'~/.oci/config', u'volume_attachment_id': 
> > None}}, 'changed': False, 'ansible_facts': 
> > {u'discovered_interpreter_python': u'/usr/bin/python'}}) 
> > 
> > ok: [localhost] => (item={'failed': False, 'ansible_loop_var': u'item', 
> > u'volume_attachments': [], 'item': u'', 
> > u'invocation': {u'module_args': {u'auth_type': u'api_key', 
> > u'api_user_key_pass_phrase': None, u'availability_domain': None, 
> > u'display_name': None, u'config_profile_name': u'root', 
> > u'compartment_id': u'xx', u'region': None, 
> > u'volume_id': u'xxx', u'instance_id': 
> > None, u'tenancy': None, u'api_user_key_file': None, 
> > u'api_user_fingerprint': None, u'api_user': None, 
> > u'config_file_location': u'~/.oci/config', u'volume_attachment_id': 
> > None}}, 'changed': False}) => { 
> >  "msg": "xx" 
> > } 
> > 
> > 
> 
> loop_control: 
>   label: "{{ item.invocation.module_args.volume_id }}" 
> 
> Or similar. 
> 
> V/r, 
> James Cassell 
> 
> -- 
> 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-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/f46e6744-4e77-4f23-a5a0-51997c98932e%40googlegroups.com
>  
> .

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5A36343B-253E-4D64-8273-B456C5261CDD%40redhat.com.