Re: [ansible-project] How to syntax check list of tasks

2018-09-21 Thread Kai Stian Olstad

On 20.09.2018 08:15, furstenh...@geoblink.com wrote:
This might be in the docs, but I cannot find it. I have the following 
files:


first-playbook.yml
second-playbook.yml
common-tasks.yml

common-tasks.yml is a list of tasks that is used in first-playbook.yml 
and

second-playbook.yml through include_tasks common-tasks.yml

I'd like to syntax check everything before deploying. For playbooks I 
can

do:

ansible-playbook --syntax-check first-playbook.yml

However, it is not possible for common tasks because it is a list of 
tasks


https://github.com/ansible/ansible/issues/16778


Another option would be that tasks got validated when including them, 
but

that is not the case:

https://github.com/ansible/ansible/issues/15709



Is there a flag/ansible command that I can use to syntax check a list 
of

tasks?


Not an answer to you question but some other way to do it.

Instead of include_tasks create a role common and put the task(s) there 
and add the role to both palybook, then they will get syntax checked.


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


Re: [ansible-project] How to syntax check list of tasks

2018-09-21 Thread Gabriel Furstenheim
At the moment what I'm doing is a nasty hack like:

   touch FAKE_PLAYBOOK.yml
   echo "host: foo" > FAKE_PLAYBOOK.yml
   echo "  tasks">> FAKE_PLAYBOOK.yml
   cat common_tasks.yml | awk '{print "" $0 }'
   ansible-playbook --syntax-check FAKE_PLAYBOOK.yml

Obviously that only scores as hack

El jue., 20 sept. 2018 a las 19:23, Andrew Latham ()
escribió:

> Maybe something like this: python -c 'import
> yaml,sys;yaml.safe_load(sys.stdin)' < common-tasks.yml
>
> On Thu, Sep 20, 2018 at 1:15 AM  wrote:
>
>> This might be in the docs, but I cannot find it. I have the following
>> files:
>>
>> first-playbook.yml
>> second-playbook.yml
>> common-tasks.yml
>>
>> common-tasks.yml is a list of tasks that is used in first-playbook.yml
>> and second-playbook.yml through include_tasks common-tasks.yml
>>
>> I'd like to syntax check everything before deploying. For playbooks I can
>> do:
>>
>> ansible-playbook --syntax-check first-playbook.yml
>>
>> However, it is not possible for common tasks because it is a list of tasks
>>
>> https://github.com/ansible/ansible/issues/16778
>>
>>
>> Another option would be that tasks got validated when including them, but
>> that is not the case:
>>
>> https://github.com/ansible/ansible/issues/15709
>>
>>
>>
>> Is there a flag/ansible command that I can use to syntax check a list of
>> tasks?
>>
>> Ansible version
>>
>> ansible 2.6.4
>>
>>
>> --
>> 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/1b131041-d605-48fd-94c2-7fa15cd59e86%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> - Andrew "lathama" Latham -
>
> --
> 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%2Bqj4S_NktU2AuT0LVqDDDR7zwMYMF80R0OFJ5b66_avQVtarg%40mail.gmail.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/CALgWzWd1_jTJvKOnzkf-b0QyoR63ocSU2MeJ4Xf1rePc94q72w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to syntax check list of tasks

2018-09-20 Thread Andrew Latham
Maybe something like this: python -c 'import
yaml,sys;yaml.safe_load(sys.stdin)' < common-tasks.yml

On Thu, Sep 20, 2018 at 1:15 AM  wrote:

> This might be in the docs, but I cannot find it. I have the following
> files:
>
> first-playbook.yml
> second-playbook.yml
> common-tasks.yml
>
> common-tasks.yml is a list of tasks that is used in first-playbook.yml and
> second-playbook.yml through include_tasks common-tasks.yml
>
> I'd like to syntax check everything before deploying. For playbooks I can
> do:
>
> ansible-playbook --syntax-check first-playbook.yml
>
> However, it is not possible for common tasks because it is a list of tasks
>
> https://github.com/ansible/ansible/issues/16778
>
>
> Another option would be that tasks got validated when including them, but
> that is not the case:
>
> https://github.com/ansible/ansible/issues/15709
>
>
>
> Is there a flag/ansible command that I can use to syntax check a list of
> tasks?
>
> Ansible version
>
> ansible 2.6.4
>
>
> --
> 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/1b131041-d605-48fd-94c2-7fa15cd59e86%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
- Andrew "lathama" Latham -

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