Re: [ansible-project] Re: ansible conditions

2018-02-05 Thread Sidh
Thanks, got more info after debugging. 
It's resolved. Idea and when condition was ok. Only issue was that i was 
evaluating wrong parameterized input in this case.

Regards,
Sidh

On Sunday, February 4, 2018 at 9:22:33 PM UTC+1, eshan TANDON wrote:
>
> Hi Sudhir,
> Try logging the actual values:
>
> - debug: var=vg_name verbosity=3
>
> - debug: var=mtpt_size verbosity=3
>
>
> Thanks,
> Eshan
>
>
> On Sun, Feb 4, 2018 at 3:04 PM, Sudhir Kumar  > wrote:
>
>> Hi All,
>>
>> Seems like some miscommunication here. I provided code in my first 
>> comment :
>>
>> #
>>   - name: Executing lvm script 
>> shell: /tmp/lvm-script.sh sdb {{ vg_name }} {{ mtpt_size }} 
>> args:
>>   chdir: /tmp/
>> when: vg_name is defined
>> ##
>>
>> And using with  jenkins + parameterized input. 
>>
>> So, if any parameterized input present then ansible should fire above 
>> script . If no input is provided then it should not trigger above snippet. 
>>
>> Hope it's clear now.
>>
>> Regards,
>> Sidh
>>
>> On Sunday, February 4, 2018 at 12:20:36 PM UTC+1, Varun Chopra wrote:
>>>
>>> Hi Sudhir,
>>>
>>> You're barely making sense and it doesn't help when you don't provide 
>>> any code.
>>>
>>> Nobody can help you if they don't understand you.
>>>
>>> --
>>> Varun
>>>
>>> On Thursday, February 1, 2018 at 9:11:08 PM UTC+5:30, Sudhir Kumar wrote:

 Hi,

 Below snippet sometimes working and sometimes failing. So, i am 
 executing it with jenkins and idea is that if parameter is defined then 
 script should run otherwise it should not run. 

 Can anyone please enlighten me what's wrong ?

 #
   - name: Executing lvm script 
 shell: /tmp/lvm-script.sh sdb {{ vg_name }} {{ mtpt_size }} 
 args:
   chdir: /tmp/
 when: vg_name is defined
 ##

>>> -- 
>> 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/706a2822-ca39-4a02-a397-941819bc819f%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Warm Regards,
> Eshan Tandon
>

-- 
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/76e9a08c-b085-4e24-b5ab-264d2319a307%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: ansible conditions

2018-02-04 Thread eshan TANDON
Hi Sudhir,
Try logging the actual values:

- debug: var=vg_name verbosity=3

- debug: var=mtpt_size verbosity=3


Thanks,
Eshan


On Sun, Feb 4, 2018 at 3:04 PM, Sudhir Kumar 
wrote:

> Hi All,
>
> Seems like some miscommunication here. I provided code in my first comment
> :
>
> #
>   - name: Executing lvm script
> shell: /tmp/lvm-script.sh sdb {{ vg_name }} {{ mtpt_size }}
> args:
>   chdir: /tmp/
> when: vg_name is defined
> ##
>
> And using with  jenkins + parameterized input.
>
> So, if any parameterized input present then ansible should fire above
> script . If no input is provided then it should not trigger above snippet.
>
> Hope it's clear now.
>
> Regards,
> Sidh
>
> On Sunday, February 4, 2018 at 12:20:36 PM UTC+1, Varun Chopra wrote:
>>
>> Hi Sudhir,
>>
>> You're barely making sense and it doesn't help when you don't provide any
>> code.
>>
>> Nobody can help you if they don't understand you.
>>
>> --
>> Varun
>>
>> On Thursday, February 1, 2018 at 9:11:08 PM UTC+5:30, Sudhir Kumar wrote:
>>>
>>> Hi,
>>>
>>> Below snippet sometimes working and sometimes failing. So, i am
>>> executing it with jenkins and idea is that if parameter is defined then
>>> script should run otherwise it should not run.
>>>
>>> Can anyone please enlighten me what's wrong ?
>>>
>>> #
>>>   - name: Executing lvm script
>>> shell: /tmp/lvm-script.sh sdb {{ vg_name }} {{ mtpt_size }}
>>> args:
>>>   chdir: /tmp/
>>> when: vg_name is defined
>>> ##
>>>
>> --
> 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/706a2822-ca39-4a02-a397-941819bc819f%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Warm Regards,
Eshan Tandon

-- 
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/CAPRmaHE_q7nSgUu%2Buh9DoQudjK13sQGJu-O-9mrdja4_fUtiTQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ansible conditions

2018-02-04 Thread Sudhir Kumar
Hi All,

Seems like some miscommunication here. I provided code in my first comment :

#
  - name: Executing lvm script 
shell: /tmp/lvm-script.sh sdb {{ vg_name }} {{ mtpt_size }} 
args:
  chdir: /tmp/
when: vg_name is defined
##

And using with  jenkins + parameterized input. 

So, if any parameterized input present then ansible should fire above 
script . If no input is provided then it should not trigger above snippet. 

Hope it's clear now.

Regards,
Sidh

On Sunday, February 4, 2018 at 12:20:36 PM UTC+1, Varun Chopra wrote:
>
> Hi Sudhir,
>
> You're barely making sense and it doesn't help when you don't provide any 
> code.
>
> Nobody can help you if they don't understand you.
>
> --
> Varun
>
> On Thursday, February 1, 2018 at 9:11:08 PM UTC+5:30, Sudhir Kumar wrote:
>>
>> Hi,
>>
>> Below snippet sometimes working and sometimes failing. So, i am executing 
>> it with jenkins and idea is that if parameter is defined then script should 
>> run otherwise it should not run. 
>>
>> Can anyone please enlighten me what's wrong ?
>>
>> #
>>   - name: Executing lvm script 
>> shell: /tmp/lvm-script.sh sdb {{ vg_name }} {{ mtpt_size }} 
>> args:
>>   chdir: /tmp/
>> when: vg_name is defined
>> ##
>>
>

-- 
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/706a2822-ca39-4a02-a397-941819bc819f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ansible conditions

2018-02-04 Thread Varun Chopra
Hi Sudhir,

You're barely making sense and it doesn't help when you don't provide any 
code.

Nobody can help you if they don't understand you.

--
Varun

On Thursday, February 1, 2018 at 9:11:08 PM UTC+5:30, Sudhir Kumar wrote:
>
> Hi,
>
> Below snippet sometimes working and sometimes failing. So, i am executing 
> it with jenkins and idea is that if parameter is defined then script should 
> run otherwise it should not run. 
>
> Can anyone please enlighten me what's wrong ?
>
> #
>   - name: Executing lvm script 
> shell: /tmp/lvm-script.sh sdb {{ vg_name }} {{ mtpt_size }} 
> args:
>   chdir: /tmp/
> when: vg_name is defined
> ##
>

-- 
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/c12969fc-c2a3-4900-bc87-f482670918fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: ansible conditions

2018-02-03 Thread Sudhir Kumar
Can you please give me an example for that or refer documentation on how 
can i do this : "when' in ansible ?

On Saturday, February 3, 2018 at 7:31:50 PM UTC+1, 
rhys.jame...@googlemail.com wrote:
>
> Is it possible the varibale is defined but unset. Why not test that the 
> length of string is > 0 instead?
>
> On Saturday, February 3, 2018 at 2:18:52 AM UTC+1, Sudhir Kumar wrote:
>>
>>
>> when: is not working as expected, So, even if i don't pass parameters 
>> then also it tries to run and then fails. So error is : from script i.e. 
>> parameters not passed. 
>> But ideally, it should skip this if parameter is not supplied.
>>
>> Regards,
>> Sidh
>>
>>
>>
>> On Friday, February 2, 2018 at 2:35:22 PM UTC+1, Kai Stian Olstad wrote:
>>>
>>> On Friday, 2 February 2018 12.56.23 CET Sudhir Kumar wrote: 
>>> > Hi All, 
>>> > 
>>> > Any ideas ? 
>>>
>>> Not without the actual error message you get. 
>>>
>>> -- 
>>> 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 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/15066bd5-a390-48c0-974f-afa4589c117e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: ansible conditions

2018-02-03 Thread rhys.james.campbell via Ansible Project
Is it possible the varibale is defined but unset. Why not test that the 
length of string is > 0 instead?

On Saturday, February 3, 2018 at 2:18:52 AM UTC+1, Sudhir Kumar wrote:
>
>
> when: is not working as expected, So, even if i don't pass parameters then 
> also it tries to run and then fails. So error is : from script i.e. 
> parameters not passed. 
> But ideally, it should skip this if parameter is not supplied.
>
> Regards,
> Sidh
>
>
>
> On Friday, February 2, 2018 at 2:35:22 PM UTC+1, Kai Stian Olstad wrote:
>>
>> On Friday, 2 February 2018 12.56.23 CET Sudhir Kumar wrote: 
>> > Hi All, 
>> > 
>> > Any ideas ? 
>>
>> Not without the actual error message you get. 
>>
>> -- 
>> 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 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/e40c6a39-01c8-4d49-9b2e-1b1a5effceb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: ansible conditions

2018-02-02 Thread Sudhir Kumar

when: is not working as expected, So, even if i don't pass parameters then 
also it tries to run and then fails. So error is : from script i.e. 
parameters not passed. 
But ideally, it should skip this if parameter is not supplied.

Regards,
Sidh



On Friday, February 2, 2018 at 2:35:22 PM UTC+1, Kai Stian Olstad wrote:
>
> On Friday, 2 February 2018 12.56.23 CET Sudhir Kumar wrote: 
> > Hi All, 
> > 
> > Any ideas ? 
>
> Not without the actual error message you get. 
>
> -- 
> 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 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/adb6504b-738f-49ae-a021-21983ed61e29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: ansible conditions

2018-02-02 Thread Kai Stian Olstad
On Friday, 2 February 2018 12.56.23 CET Sudhir Kumar wrote:
> Hi All,
> 
> Any ideas ?

Not without the actual error message you get.

-- 
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 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/4956300.KnTNHLyy20%40x1.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ansible conditions

2018-02-02 Thread Sudhir Kumar
Hi All,

Any ideas ?

Sidh

On Thursday, February 1, 2018 at 4:41:08 PM UTC+1, Sudhir Kumar wrote:
>
> Hi,
>
> Below snippet sometimes working and sometimes failing. So, i am executing 
> it with jenkins and idea is that if parameter is defined then script should 
> run otherwise it should not run. 
>
> Can anyone please enlighten me what's wrong ?
>
> #
>   - name: Executing lvm script 
> shell: /tmp/lvm-script.sh sdb {{ vg_name }} {{ mtpt_size }} 
> args:
>   chdir: /tmp/
> when: vg_name is defined
> ##
>

-- 
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/fd2006e9-d86b-4092-9850-42f1a0afc8dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible conditions and logics

2014-04-02 Thread Marcin Prączko
Hi, 

I think that you have to find best way which works for you.

For example I have to setup quite a lot munin symlinks for checks which 
depends of server role.
1. Running this via ansible was really slow and caused quite complicated 
solution in terms of map links to roles. 

2. So I decided to write SHell template - which allow much easier setup 
conditions and control what must be run when server belong to some goup, 
and then in role have following tasks.
- Copy shell script from template (during copy - ansible genertes 
everything what is requried in terms of symlinks for munin).
- Run shell script.

This solution is fast for ansible now and all what I have to do is update 
template if some sym links must be adjusted (added /removed).

Hope that will help you as well.

Best regards,
Marcin Praczko

-- 
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/ab6ac35f-f9a9--bd84-cd13cbc57ace%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.