Your yml files that you have referenced are not properly formatted plays. Read over this documentation: https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html#playbook-language-example
Ultimately, your first file is just a file with a task in it, and your 2nd is missing the `tasks:` header. On Mon, May 4, 2020 at 10:13 AM Amit Kumar <[email protected]> wrote: > Hi , > > As i have created two simple playbook to remove file from window system > and create the file on window system. > But getting error while i execute the both playbook. (Ansible controller > version is 2.9) > > 1. remove_file.yml > --- > - name: remove a file (check mode) > hosts: win > win_package: > path: C:\ansible_wu.txt > state: absent > register: remove_file_check > check_mode: yes > *************************************************** > Error- > *************************************************** > ERROR! 'win_package' is not a valid attribute for a Play > > The error appears to be in '/home/ansible/rx_testing/win_remove_file.yml': > line 2, column 4, but may > be elsewhere in the file depending on the exact syntax problem. > > The offending line appears to be: > > --- > - name: remove a file (check mode) > ^ here > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 2. touch.yml > --- > - hosts: win > name: Create the file > win_file: > path: C:\amit.txt > state: touch > _________________ > Error > ------------------------------ > ERROR! 'win_file' is not a valid attribute for a Play > > The error appears to be in '/home/ansible/rx_testing/win_touch.yml': line > 2, column 4, but may > be elsewhere in the file depending on the exact syntax problem. > > The offending line appears to be: > > --- > - hosts: win > ^ here > ************************************************************************* > > Regards > Amit > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/41963f29-5fd4-4d6e-b2db-f063ae6361e7%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/41963f29-5fd4-4d6e-b2db-f063ae6361e7%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Matt Martz @sivel sivel.net -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v_Pzi5oKuoaDFbhGv%2BPjBPLmvG-3fJsQxegA1rd1E4YNQ%40mail.gmail.com.
