This seems very likely a crossed-up install, where your ANSIBLE_LIBRARY
path isn't quite set right and you have a new ansible pointing at an old
library version.

If running from a checkout, run source ./hacking/env-setup and it will set
things up to run from source.




On Wed, Apr 23, 2014 at 1:48 PM, Michael Sphar <[email protected]> wrote:

> (oops, sorry, accidentally replied privately rather than to the
> group...seriously noobing it up today...)
>
> Hmm...I fixed that, but still getting the same syntax error:  "ERROR:
> assert is not a legal parameter in an Ansible task or handler"
>
>
>   tasks:
>      - assert:
>            that:
>                - commonWeekday.stdout == "Saturday"
>                - ansible_date_time.hour == "10"
>                - commonResultBackup!success
>
>
>
>
>
> On Wed, Apr 23, 2014 at 11:56 AM, Matt Martz <[email protected]> wrote:
>
>> You need to indent your 'that' key further:
>>
>>   tasks:
>>
>>       - assert:
>>
>>             that:
>>
>>                 - commonWeekday.stdout == "Saturday"
>>
>>                 - ansible_date_time.hour == "10"
>>
>>                 - commonResultBackup!success
>> --
>> Matt Martz
>> [email protected]
>>
>> On April 23, 2014 at 11:54:34 AM, Michael Sphar ([email protected])
>> wrote:
>>
>> I'm still pretty new to ansible, so I feel like I am probably doing
>> something really stupid, but I cannot get the assert module to work.
>>
>> I have ansible version 1.5.3.  I'm getting "ERROR: assert is not a legal
>> parameter in an Ansible task or handler" in all my attempts to use an
>> assert.  I've been searching the docs and all I can find is the doc which
>> gives a snippet example of using assert and my attempts to copy that aren't
>> working, and I can't find an actual complete playbook example that includes
>> the use of assert to compare to.
>>
>> What I'm trying to do, assert may not even be the right approach for.
>>  Basically I'm developing a playbook for automated reboots that is *very*
>> dangerous during production hours and which should only ever be allowed to
>> run on a Saturday during a designated window, and so I want the playbook to
>> include some explicit rules that will prevent it from rebooting when it's
>> not supposed to, even if some chucklehead accidentally executes it during
>> the week.
>>
>> Ideally, I'd be able just reference an ansible fact for the day of the
>> week, but I can't seem to find one? So I'm using the date command to get
>> the day of the week and registering that into a variable.  Then I want to
>> abort the playbook when that and another condition are not met.
>>
>> My test playbook looks like this (the tasks that set commonWeekday and
>> commonResultBackup are in roles/common/tasks/main.yml):
>>
>>  REBOOTGROUP_SAT_10AM.yml:
>>
>> ---
>>
>> - hosts: REBOOTGROUP_SAT_10AM
>>
>>   roles:
>>
>>     - common
>>
>>
>>   tasks:
>>
>>     - assert:
>>
>>       that:
>>
>>         - commonWeekday.stdout == "Saturday"
>>
>>         - ansible_date_time.hour == "10"
>>
>>         - commonResultBackup!success
>>
>>
>>     - name:  Reboot the server with warning delay - Don't wait for it to
>> complete
>>
>>       command: shutdown -r +5 Automated Weekly Reboot
>>
>>       sudo: yes
>>
>>       async: 600
>>
>>       poll: 0
>>
>>       ignore_errors: true
>>
>>
>> And if I test it:
>>
>>
>> $ ansible-playbook --syntax-check REBOOTGROUP_SAT_10AM.yml
>>
>> playbook: REBOOTGROUP_SAT_10AM.yml
>>
>> ERROR: assert is not a legal parameter in an Ansible task or handler
>>
>>
>>
>>  --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/895b2035-523d-4e2f-a0de-e4e447f11ec5%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/895b2035-523d-4e2f-a0de-e4e447f11ec5%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAJrtzLSy1p_Ya7xuAw8jOf4vNP0oxJRN7bEEiyG5U3hE97W8-w%40mail.gmail.com<https://groups.google.com/d/msgid/ansible-project/CAJrtzLSy1p_Ya7xuAw8jOf4vNP0oxJRN7bEEiyG5U3hE97W8-w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> 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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgzAoQ8Auo6rhTq%3DRy6oJUkK2Wjmo6ZSu84SvMh9E7NwRg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to