ERROR! 'win_package' is not a valid attribute for a Play (Ansible controller version is 2.9)

2,402 views
Skip to first unread message

Amit Kumar

unread,
May 4, 2020, 11:13:44 AM5/4/20
to Ansible Project
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

abhay srivastava

unread,
May 4, 2020, 11:48:55 AM5/4/20
to ansible...@googlegroups.com
Please installed pywin module in Ansible server.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/41963f29-5fd4-4d6e-b2db-f063ae6361e7%40googlegroups.com.


--
Regards,
Abhay Srivastava
---------------------------
Mob-9160512000

Matt Martz

unread,
May 4, 2020, 11:52:59 AM5/4/20
to ansible...@googlegroups.com
Your yml files that you have referenced are not properly formatted plays.


Ultimately, your first file is just a file with a task in it, and your 2nd is missing the `tasks:` header.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/41963f29-5fd4-4d6e-b2db-f063ae6361e7%40googlegroups.com.


--
Matt Martz
@sivel
sivel.net
Reply all
Reply to author
Forward
0 new messages