Re: [ansible-project] Re: unable to fit the piece of code in ansible

2018-04-13 Thread Bishwajit Samanta
Ansible:: 2.4 is the version i am using.

On Friday, April 13, 2018 at 11:40:02 AM UTC+5:30, Biswadip Dutta wrote:
>
> Can you please let me know which Ansible version you are using and what 
> error you are getting?
>
> Regards,
> Biswadip Dutta
>
> On Thu, Apr 12, 2018 at 7:16 PM, Bishwajit Samanta <
> bishwajits...@gmail.com > wrote:
>
>> Thanks Karl, for your reply. Problem statement ::-
>>
>> My job is to find out the hostname which belongs to hostclass ess, which 
>> in this case the answer is host002.
>>
>> hostinfo:
>>   'host001':
>> ip: 192.168.43.10
>> hostclass: 'puppet'
>>   'host002':
>> ip: 192.168.43.11
>> hostclass: 'ess'
>>   'host003':
>> ip: 192.168.43.21
>> hostclass: 'mdb'
>>
>>
>> i got one solution from some friend in google ansible groups only, but i 
>> am unable to fit it my ansible playbook.
>>
>>
>> - debug:
>> msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
>> 'ess')|first|first }}"
>>
>>
>> The playbook i am writing, which is wrong but i am not able to figure out 
>> how to fit the code in my playbook. Can anyone help me in modifying the 
>> code of mine.
>>
>> ---
>>
>> - hosts: somehost
>>   gather_facts: no
>>   vars_files:
>> file: sometext.yaml
>> name: sometext
>>
>>   - debug:
>> msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
>> 'ess')|first|first }}
>>
>>
>> On Thursday, April 12, 2018 at 5:52:14 PM UTC+5:30, Karl Auer wrote:
>>>
>>> Can I suggest that you describe what you want to achieve. That is, 
>>> describe the end result that you are seeking.
>>>
>>> That is more likely to get a useful response.
>>>
>>> Regards, K.
>>>
>>>
>>> On Thu, Apr 12, 2018 at 9:58 PM, Bishwajit Samanta <
>>> bishwajits...@gmail.com> wrote:
>>>
 Any one can suggest any idea please..

 On Thursday, April 12, 2018 at 8:21:32 AM UTC+5:30, Bishwajit Samanta 
 wrote:
>
> Hi all,
>
> I am a beginner in ansible. If anyone can help me in finding the 
> answer. It would be great. My problem was finding a phrase in ansible 
> which 
> one of the person have helped me. But unfortunately i am not able to fit 
> the piece of code in my playbook.
>
> hostinfo:
>   host001':
> ip: 192.168.43.10
> hostclass: 'puppet'
>   'host002':
> ip: 192.168.43.11
> hostclass: 'ess'
>   'host003':
> ip: 192.168.43.21
> hostclass: 'mdb'
>
> the code was::
>
> - debug: 
>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
> 'ess')|first|first }}"
>
> Now i am writing the code as given below. I know in this piece of code 
> i am making mistakes. But since i am a beginner i am not able to 
> understand 
> it. Can anyone help me?
>
> ---
> - hosts: test
>   gather_facts: no 
>
> - debug: 
>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
> 'ess')|first|first }}"
>
> -- 
 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 post to this group, send email to ansible...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/ansible-project/4431f374-65b9-4884-9acb-f709bdd658f3%40googlegroups.com
  
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>>
>>> -- 
>>> Karl Auer
>>>
>>> Email  : ka...@2pisoftware.com
>>> Website: http://2pisoftware.com
>>>
>>> GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
>>> Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA
>>>
>> -- 
>> 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 post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/bacee1a5-37a0-423a-9dcf-a8625c361493%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 

Re: [ansible-project] Re: unable to fit the piece of code in ansible

2018-04-13 Thread Biswadip Dutta
Can you please let me know which Ansible version you are using and what
error you are getting?

Regards,
Biswadip Dutta

On Thu, Apr 12, 2018 at 7:16 PM, Bishwajit Samanta <
bishwajitsamanta1...@gmail.com> wrote:

> Thanks Karl, for your reply. Problem statement ::-
>
> My job is to find out the hostname which belongs to hostclass ess, which
> in this case the answer is host002.
>
> hostinfo:
>   'host001':
> ip: 192.168.43.10
> hostclass: 'puppet'
>   'host002':
> ip: 192.168.43.11
> hostclass: 'ess'
>   'host003':
> ip: 192.168.43.21
> hostclass: 'mdb'
>
>
> i got one solution from some friend in google ansible groups only, but i
> am unable to fit it my ansible playbook.
>
>
> - debug:
> msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
> 'ess')|first|first }}"
>
>
> The playbook i am writing, which is wrong but i am not able to figure out
> how to fit the code in my playbook. Can anyone help me in modifying the
> code of mine.
>
> ---
>
> - hosts: somehost
>   gather_facts: no
>   vars_files:
> file: sometext.yaml
> name: sometext
>
>   - debug:
> msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
> 'ess')|first|first }}
>
>
> On Thursday, April 12, 2018 at 5:52:14 PM UTC+5:30, Karl Auer wrote:
>>
>> Can I suggest that you describe what you want to achieve. That is,
>> describe the end result that you are seeking.
>>
>> That is more likely to get a useful response.
>>
>> Regards, K.
>>
>>
>> On Thu, Apr 12, 2018 at 9:58 PM, Bishwajit Samanta <
>> bishwajits...@gmail.com> wrote:
>>
>>> Any one can suggest any idea please..
>>>
>>> On Thursday, April 12, 2018 at 8:21:32 AM UTC+5:30, Bishwajit Samanta
>>> wrote:

 Hi all,

 I am a beginner in ansible. If anyone can help me in finding the
 answer. It would be great. My problem was finding a phrase in ansible which
 one of the person have helped me. But unfortunately i am not able to fit
 the piece of code in my playbook.

 hostinfo:
   host001':
 ip: 192.168.43.10
 hostclass: 'puppet'
   'host002':
 ip: 192.168.43.11
 hostclass: 'ess'
   'host003':
 ip: 192.168.43.21
 hostclass: 'mdb'

 the code was::

 - debug:
   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto',
 'ess')|first|first }}"

 Now i am writing the code as given below. I know in this piece of code
 i am making mistakes. But since i am a beginner i am not able to understand
 it. Can anyone help me?

 ---
 - hosts: test
   gather_facts: no

 - debug:
   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto',
 'ess')|first|first }}"

 --
>>> 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 post to this group, send email to ansible...@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/ansible-project/4431f374-65b9-4884-9acb-f709bdd658f3%
>>> 40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Karl Auer
>>
>> Email  : ka...@2pisoftware.com
>> Website: http://2pisoftware.com
>>
>> GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
>> Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA
>>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/bacee1a5-37a0-423a-9dcf-a8625c361493%40googlegroups.
> com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEC%3DuX%3DgAuY8WkqJFnfoivSU8hu2-0At2WXE%3DWp5j2p%3DzZmAeQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: unable to fit the piece of code in ansible

2018-04-12 Thread Bishwajit Samanta
Thanks Karl, for your reply. Problem statement ::-

My job is to find out the hostname which belongs to hostclass ess, which in 
this case the answer is host002.

hostinfo:
  'host001':
ip: 192.168.43.10
hostclass: 'puppet'
  'host002':
ip: 192.168.43.11
hostclass: 'ess'
  'host003':
ip: 192.168.43.21
hostclass: 'mdb'


i got one solution from some friend in google ansible groups only, but i am 
unable to fit it my ansible playbook.


- debug:
msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
'ess')|first|first }}"


The playbook i am writing, which is wrong but i am not able to figure out 
how to fit the code in my playbook. Can anyone help me in modifying the 
code of mine.

---

- hosts: somehost
  gather_facts: no
  vars_files:
file: sometext.yaml
name: sometext

  - debug:
msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
'ess')|first|first }}


On Thursday, April 12, 2018 at 5:52:14 PM UTC+5:30, Karl Auer wrote:
>
> Can I suggest that you describe what you want to achieve. That is, 
> describe the end result that you are seeking.
>
> That is more likely to get a useful response.
>
> Regards, K.
>
>
> On Thu, Apr 12, 2018 at 9:58 PM, Bishwajit Samanta <
> bishwajits...@gmail.com > wrote:
>
>> Any one can suggest any idea please..
>>
>> On Thursday, April 12, 2018 at 8:21:32 AM UTC+5:30, Bishwajit Samanta 
>> wrote:
>>>
>>> Hi all,
>>>
>>> I am a beginner in ansible. If anyone can help me in finding the answer. 
>>> It would be great. My problem was finding a phrase in ansible which one of 
>>> the person have helped me. But unfortunately i am not able to fit the piece 
>>> of code in my playbook.
>>>
>>> hostinfo:
>>>   host001':
>>> ip: 192.168.43.10
>>> hostclass: 'puppet'
>>>   'host002':
>>> ip: 192.168.43.11
>>> hostclass: 'ess'
>>>   'host003':
>>> ip: 192.168.43.21
>>> hostclass: 'mdb'
>>>
>>> the code was::
>>>
>>> - debug: 
>>>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
>>> 'ess')|first|first }}"
>>>
>>> Now i am writing the code as given below. I know in this piece of code i 
>>> am making mistakes. But since i am a beginner i am not able to understand 
>>> it. Can anyone help me?
>>>
>>> ---
>>> - hosts: test
>>>   gather_facts: no 
>>>
>>> - debug: 
>>>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto', 
>>> 'ess')|first|first }}"
>>>
>>> -- 
>> 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 post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/4431f374-65b9-4884-9acb-f709bdd658f3%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Karl Auer
>
> Email  : ka...@2pisoftware.com 
> Website: http://2pisoftware.com
>
> GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
> Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA
>

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/bacee1a5-37a0-423a-9dcf-a8625c361493%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: unable to fit the piece of code in ansible

2018-04-12 Thread Karl Auer
Can I suggest that you describe what you want to achieve. That is, describe
the end result that you are seeking.

That is more likely to get a useful response.

Regards, K.


On Thu, Apr 12, 2018 at 9:58 PM, Bishwajit Samanta <
bishwajitsamanta1...@gmail.com> wrote:

> Any one can suggest any idea please..
>
> On Thursday, April 12, 2018 at 8:21:32 AM UTC+5:30, Bishwajit Samanta
> wrote:
>>
>> Hi all,
>>
>> I am a beginner in ansible. If anyone can help me in finding the answer.
>> It would be great. My problem was finding a phrase in ansible which one of
>> the person have helped me. But unfortunately i am not able to fit the piece
>> of code in my playbook.
>>
>> hostinfo:
>>   host001':
>> ip: 192.168.43.10
>> hostclass: 'puppet'
>>   'host002':
>> ip: 192.168.43.11
>> hostclass: 'ess'
>>   'host003':
>> ip: 192.168.43.21
>> hostclass: 'mdb'
>>
>> the code was::
>>
>> - debug:
>>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto',
>> 'ess')|first|first }}"
>>
>> Now i am writing the code as given below. I know in this piece of code i
>> am making mistakes. But since i am a beginner i am not able to understand
>> it. Can anyone help me?
>>
>> ---
>> - hosts: test
>>   gather_facts: no
>>
>> - debug:
>>   msg: "{{ hostinfo|dictsort|selectattr('1.hostclass', 'equalto',
>> 'ess')|first|first }}"
>>
>> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/4431f374-65b9-4884-9acb-f709bdd658f3%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Karl Auer

Email  : ka...@2pisoftware.com
Website: http://2pisoftware.com

GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2B%2BT08QTxShbDcAykEAFbagCtuKepfV3z51qZ3aLzPJhoW1%2BBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.