Thank you Abhijeet and team for support and immediate response 😊😊 Thanks & Regards Arvind Kumar Cell:- 9555962061.
*Thanks & Regards* *Arvind Kumar* *Cell:- 9555962061.* On Tue, Apr 21, 2020 at 10:51 AM Abhijeet Kasurde <[email protected]> wrote: > with_items is a task level parameter and not vmware_guest_snapshot > parameter. To fix, you might want to match the indentation of with_items > with delegate_to or register parameters. > > Please read > https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#with-items > > On Mon, Apr 20, 2020 at 5:04 PM Arvind kumar <[email protected]> > wrote: > >> HI, I have Created a playbook to take a snapshot before patching of >> servers but this playbook has only one Guest_vm define so it working >> perfectly for me. >> >> *- name: Vmware guest snapshot create* >> * hosts: test-hypervisor* >> >> * tasks:* >> >> * - name: Create a snapshot* >> * vmware_guest_snapshot:* >> * hostname: test-hypervisior* >> * username: root* >> * password: asdfghj123** >> * datacenter: test-hypervisior* >> * folder: " /folder1/localhost.example.com/vm >> <http://localhost.example.com/vm>"* >> * name: RJRedhat01* >> * state: present* >> * validate_certs: False* >> * snapshot_name: snap55* >> * description: Test snapshot* >> * delegate_to: localhost* >> * register: snapshot_info* >> * - name: show the status* >> * debug:* >> * var: snapshot_info.snapshot_results* >> >> >> #### Above Playbook is working fine for me', But I have dozens of server >> and I want to create the snapshot of all nodes, I am using * with_item* >> for looping all nodes but it is not working for me. >> >> >> My Playbook for Multi vm_guest snapshot creation >> >> *- name: Vmware guest snapshot create* >> * hosts: test-hypervisior* >> * tasks:* >> >> * - name: Create a snapshot* >> * vmware_guest_snapshot:* >> * hostname: test-hypervisior* >> * username: root* >> * password: asdfghj123** >> * datacenter: test-hypervisior* >> * folder: " /folder1/localhost.example.com/vm >> <http://localhost.example.com/vm>"* >> * name: "{{ item}}"* >> * with_items:* >> * - RJCentos1* >> * - RJRedhat01* >> * - MAXFAX01* >> * state: present* >> * validate_certs: False* >> * snapshot_name: snap__with_multi_vms* >> * description: snap1_descriptioninnn* >> * delegate_to: localhost* >> * register: snapshot_info* >> * - name: show the status* >> * debug:* >> * var: snapshot_info.snapshot_results* >> >> @@@@@@@@@@@@@@@@@@@@@@@@@@@@ >> >> ansible-playbook vm-snap-c2.yaml -u root -k >> SSH password: >> >> PLAY [Vmware guest snapshot create] >> ************************************************************************************************************************************* >> >> TASK [Gathering Facts] >> ************************************************************************************************************************************************** >> Monday 20 April 2020 07:28:44 -0400 (0:00:00.056) 0:00:00.056 >> ********** >> ok: [test-hypervisior] >> >> TASK [Create a snapshot] >> ************************************************************************************************************************************************ >> Monday 20 April 2020 07:28:46 -0400 (0:00:02.462) 0:00:02.519 >> ********** >> fatal: [test-hypervisior]: FAILED! => {"msg": "The task includes an >> option with an undefined variable.* The error was: 'item' is >> undefined\n\nThe error *appears to be in >> '/home/akumar/vm/vm-snap-c2.yaml': line 5, column 9, but may\nbe elsewhere >> in the file depending on the exact syntax problem.\n\nThe offending line >> appears to be:\n\n\n - name: Create a snapshot\n ^ here\n"} >> >> PLAY RECAP >> ************************************************************************************************************************************************************** >> test-hypervisior : ok=1 changed=0 unreachable=0 >> failed=1 skipped=0 rescued=0 ignored=0 >> >> Monday 20 April 2020 07:28:47 -0400 (0:00:00.167) 0:00:02.687 >> ********** >> >> =============================================================================== >> Gathering Facts >> -------------------------------------------------------------------------------------------------------------------------------------------------- >> 2.46s >> Create a snapshot >> ------------------------------------------------------------------------------------------------------------------------------------------------ >> 0.17s >> >> -- >> 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/635f419e-3788-4396-bb05-9fefae07bf3e%40googlegroups.com >> <https://groups.google.com/d/msgid/ansible-project/635f419e-3788-4396-bb05-9fefae07bf3e%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > Thanks, > Abhijeet Kasurde > > -- > 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/CAFwWkHqSN7GGUcrZqHRF_3f9U9kraN_yNcJOVwW0msrFPm8mBA%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAFwWkHqSN7GGUcrZqHRF_3f9U9kraN_yNcJOVwW0msrFPm8mBA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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/CAHxB99BZ%2B_wftYaoiY%3DOoV-2fKuMkb7WAtOmtyvHPFnY9mfsww%40mail.gmail.com.
