Re: [ansible-project] include not working

2018-04-17 Thread Tcpip
Hello,

Thanks for your help I will check the reference.  but the  strange thing is 
I did playbooks the same way for server and I only have issue with this 
modules.

thanks


On Tuesday, April 17, 2018 at 5:20:36 AM UTC-3, Biswadip Dutta wrote:
>
> I understand the problem now. You are trying to include a playbook under 
> the tasks level which is not allowed. A file with only tasks are allowed to 
> be included under tasks. See here 
> 
> .
>
> Also, conditionally adding playbooks is a feature request as per this 
>  from what I can find.
>
> Maybe you can restructure 2.yml a bit. Check here 
> 
>  for 
> reference.
>
> Regards,
> Biswadip Dutta
>
> On Tue, Apr 17, 2018 at 5:16 AM, Tcpip  
> wrote:
>
>> Hello,
>>
>> I test it but still the same issue, maybe is the wrong way, the idea is 
>> if the value es greater then run the other playbook.
>>
>> thanks. 
>>
>> On Monday, April 16, 2018 at 9:15:18 AM UTC-3, Biswadip Dutta wrote:
>>>
>>> Hi,
>>> I believe you should use import_playbook to add a playbook in another 
>>> playbook. See here 
>>> .
>>>
>>> Regards,
>>> Biswadip Dutta
>>>
>>> On Sat, Apr 14, 2018 at 6:12 AM, Tcpip  wrote:
>>>
 Hi all

 I have the following playbook
  
 !
 ---

  

  

 - hosts: lab
   gather_facts: true
   connection: local
   vars:
 creds:
   host: "{{ ansible_host }}"
   username: cisco
   password: cisco
  
   tasks:
 - name: ios_facts
   ios_facts:
  provider: "{{ creds }}"
   register: iosfacts
  
 - name: interface description
   ios_config:
 provider: "{{ creds }}"
 lines:
   - description test interface
 parents: "interface {{ item.key }}"
   with_dict: "{{ iosfacts.ansible_facts.ansible_net_interfaces }}"
   when: item.value.bandwidth >= 100
  
 - name: new task
   include: 2.yml
   with_dict: "{{ iosfacts.ansible_facts.ansible_net_interfaces }}"
   when: item.value.bandwidth <= 100

 !!
 And I get this error

 "reason": "no action detected in task. This often indicates a 
 misspelled module name, or incorrect module path.\n\nThe error appears to 
 have been in '/home/playbooks/varios/2.yml': line 2, column 3, but 
 may\nbe elsewhere in the file depending on the exact syntax 
 problem.\n\nThe 
 offending line appears to be:\n\n---\n- hosts: lab\n  ^ here\n\n\nThe 
 error appears to have been in '/home/playbooks/varios/2.yml': line 2, 
 column 3, but may\nbe elsewhere in the file depending on the exact syntax 
 problem.\n\nThe offending line appears to be:\n\n---\n- hosts: lab\n  
 ^ here\n"

 If I execute the playbook 2.yml in stand alone it works, if I add it to 
 my other playbook i get errors.

 Any ideas???

 -- 
 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/a6e77380-cf49-472d-932a-228b2def9fe6%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-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/90ae3f16-7a07-4a89-9279-5af66071d019%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are 

Re: [ansible-project] include not working

2018-04-17 Thread Biswadip Dutta
I understand the problem now. You are trying to include a playbook under
the tasks level which is not allowed. A file with only tasks are allowed to
be included under tasks. See here

.

Also, conditionally adding playbooks is a feature request as per this
 from what I can find.

Maybe you can restructure 2.yml a bit. Check here

for
reference.

Regards,
Biswadip Dutta

On Tue, Apr 17, 2018 at 5:16 AM, Tcpip  wrote:

> Hello,
>
> I test it but still the same issue, maybe is the wrong way, the idea is if
> the value es greater then run the other playbook.
>
> thanks.
>
> On Monday, April 16, 2018 at 9:15:18 AM UTC-3, Biswadip Dutta wrote:
>>
>> Hi,
>> I believe you should use import_playbook to add a playbook in another
>> playbook. See here
>> .
>>
>> Regards,
>> Biswadip Dutta
>>
>> On Sat, Apr 14, 2018 at 6:12 AM, Tcpip  wrote:
>>
>>> Hi all
>>>
>>> I have the following playbook
>>>
>>> !
>>> ---
>>>
>>>
>>>
>>> - hosts: lab
>>>   gather_facts: true
>>>   connection: local
>>>   vars:
>>> creds:
>>>   host: "{{ ansible_host }}"
>>>   username: cisco
>>>   password: cisco
>>>
>>>   tasks:
>>> - name: ios_facts
>>>   ios_facts:
>>>  provider: "{{ creds }}"
>>>   register: iosfacts
>>>
>>> - name: interface description
>>>   ios_config:
>>> provider: "{{ creds }}"
>>> lines:
>>>   - description test interface
>>> parents: "interface {{ item.key }}"
>>>   with_dict: "{{ iosfacts.ansible_facts.ansible_net_interfaces }}"
>>>   when: item.value.bandwidth >= 100
>>>
>>> - name: new task
>>>   include: 2.yml
>>>   with_dict: "{{ iosfacts.ansible_facts.ansible_net_interfaces }}"
>>>   when: item.value.bandwidth <= 100
>>>
>>> !!
>>> And I get this error
>>>
>>> "reason": "no action detected in task. This often indicates a
>>> misspelled module name, or incorrect module path.\n\nThe error appears to
>>> have been in '/home/playbooks/varios/2.yml': line 2, column 3, but
>>> may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe
>>> offending line appears to be:\n\n---\n- hosts: lab\n  ^ here\n\n\nThe
>>> error appears to have been in '/home/playbooks/varios/2.yml': line 2,
>>> column 3, but may\nbe elsewhere in the file depending on the exact syntax
>>> problem.\n\nThe offending line appears to be:\n\n---\n- hosts: lab\n  ^
>>> here\n"
>>>
>>> If I execute the playbook 2.yml in stand alone it works, if I add it to
>>> my other playbook i get errors.
>>>
>>> Any ideas???
>>>
>>> --
>>> 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/a6e77380-cf49-472d-932a-228b2def9fe6%
>>> 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/90ae3f16-7a07-4a89-9279-5af66071d019%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%3DuXkfRtzHdtnBy%2B1F%3DLgAY5cP2KGyyx%2BoK4ZWTUpzZUnrWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] include not working

2018-04-16 Thread Tcpip
Hello,

I test it but still the same issue, maybe is the wrong way, the idea is if 
the value es greater then run the other playbook.

thanks. 

On Monday, April 16, 2018 at 9:15:18 AM UTC-3, Biswadip Dutta wrote:
>
> Hi,
> I believe you should use import_playbook to add a playbook in another 
> playbook. See here 
> .
>
> Regards,
> Biswadip Dutta
>
> On Sat, Apr 14, 2018 at 6:12 AM, Tcpip  
> wrote:
>
>> Hi all
>>
>> I have the following playbook
>>  
>> !
>> ---  
>> 
>> 
>>  
>> - hosts: lab
>>   gather_facts: true
>>   connection: local
>>   vars:
>> creds:
>>   host: "{{ ansible_host }}"
>>   username: cisco
>>   password: cisco
>>  
>>   tasks:
>> - name: ios_facts
>>   ios_facts:
>>  provider: "{{ creds }}"
>>   register: iosfacts
>>  
>> - name: interface description
>>   ios_config:
>> provider: "{{ creds }}"
>> lines:
>>   - description test interface
>> parents: "interface {{ item.key }}"
>>   with_dict: "{{ iosfacts.ansible_facts.ansible_net_interfaces }}"
>>   when: item.value.bandwidth >= 100
>>  
>> - name: new task
>>   include: 2.yml
>>   with_dict: "{{ iosfacts.ansible_facts.ansible_net_interfaces }}"
>>   when: item.value.bandwidth <= 100
>>
>> !!
>> And I get this error
>>
>> "reason": "no action detected in task. This often indicates a 
>> misspelled module name, or incorrect module path.\n\nThe error appears to 
>> have been in '/home/playbooks/varios/2.yml': line 2, column 3, but 
>> may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe 
>> offending line appears to be:\n\n---\n- hosts: lab\n  ^ here\n\n\nThe 
>> error appears to have been in '/home/playbooks/varios/2.yml': line 2, 
>> column 3, but may\nbe elsewhere in the file depending on the exact syntax 
>> problem.\n\nThe offending line appears to be:\n\n---\n- hosts: lab\n  ^ 
>> here\n"
>>
>> If I execute the playbook 2.yml in stand alone it works, if I add it to 
>> my other playbook i get errors.
>>
>> Any ideas???
>>
>> -- 
>> 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/a6e77380-cf49-472d-932a-228b2def9fe6%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/90ae3f16-7a07-4a89-9279-5af66071d019%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] include not working

2018-04-16 Thread Biswadip Dutta
Hi,
I believe you should use import_playbook to add a playbook in another
playbook. See here
.

Regards,
Biswadip Dutta

On Sat, Apr 14, 2018 at 6:12 AM, Tcpip  wrote:

> Hi all
>
> I have the following playbook
> !
> ---
>
>
>
> - hosts: lab
>   gather_facts: true
>   connection: local
>   vars:
> creds:
>   host: "{{ ansible_host }}"
>   username: cisco
>   password: cisco
>
>   tasks:
> - name: ios_facts
>   ios_facts:
>  provider: "{{ creds }}"
>   register: iosfacts
>
> - name: interface description
>   ios_config:
> provider: "{{ creds }}"
> lines:
>   - description test interface
> parents: "interface {{ item.key }}"
>   with_dict: "{{ iosfacts.ansible_facts.ansible_net_interfaces }}"
>   when: item.value.bandwidth >= 100
>
> - name: new task
>   include: 2.yml
>   with_dict: "{{ iosfacts.ansible_facts.ansible_net_interfaces }}"
>   when: item.value.bandwidth <= 100
>
> !!
> And I get this error
>
> "reason": "no action detected in task. This often indicates a
> misspelled module name, or incorrect module path.\n\nThe error appears to
> have been in '/home/playbooks/varios/2.yml': line 2, column 3, but
> may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe
> offending line appears to be:\n\n---\n- hosts: lab\n  ^ here\n\n\nThe
> error appears to have been in '/home/playbooks/varios/2.yml': line 2,
> column 3, but may\nbe elsewhere in the file depending on the exact syntax
> problem.\n\nThe offending line appears to be:\n\n---\n- hosts: lab\n  ^
> here\n"
>
> If I execute the playbook 2.yml in stand alone it works, if I add it to my
> other playbook i get errors.
>
> Any ideas???
>
> --
> 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/a6e77380-cf49-472d-932a-228b2def9fe6%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%3DuXnjcqy9ZzDBXYE%3DOqTyourKa4RmVW3QVpNgt2EEieR-LA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.