- debug: msg="HPQC Create snapshot of a vGPU VM on ESX"
when: taskresult|succeeded
- debug: msg="HPQC Failed Create snapshot of a vGPU VM on ESX"
when: taskresult|failed
- shell: echo "HPQC Passed Create snapshot of a vGPU VM on ESX" >> results.txt
when: taskresult|succeeded
- shell: echo "HPQC Failed Create snapshot of a vGPU VM on ESX" >> results.txt
when: taskresult|failed
when i run with -vvvv switch, I get the following output but nothing is appended in the file locataed at /etc/ansible/ directoery( I am running playbook from /etc/ansible directory)
changed: [] => {
"changed": true,
"cmd": "echo \"HPQC Passed Create snapshot of a vGPU VM on ESX\" >> results.txt",
"delta": "0:00:00.017046",
"end": "2017-07-27 00:07:14.100974",
"invocation": {
"module_args": {
"_raw_params": "echo \"HPQC Passed Create snapshot of a vGPU VM on ESX\" >> results.txt",
"_uses_shell": true,
"chdir": null,
"creates": null,
"executable": null,
"removes": null,
"warn": true
}
},
"rc": 0,
"start": "2017-07-27 00:07:14.083928",
"stderr": "",
"stderr_lines": [],
"stdout": "",
"stdout_lines": []
}
TASK [ESX_VM_SnapRestore : command] ************************************************************************************************************************************************************************
task path: /etc/ansible/roles/ESX_VM_SnapRestore/tasks/main.yml:41
skipping: [1] => {
"changed": false,
"skip_reason": "Conditional result was False",
"skipped": true
}
Thanks for your help.
-VM
--
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+unsubscribe@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/050bee11a57a65b96f4d54e4c64accac%40olstad.com.
- hosts: esx1
become: true
roles:
- ESX_VM_SnapRestore
- lineinfile:
path: /etc/ansible/results.txt
line: 'HPQC Passed Create snapshot of a vGPU VM on ESX'
insertafter: EOF
when: taskresult|succeeded
delegate_to: localhost
- lineinfile:
path: /etc/ansible/results.txt
line: 'HPQC1 Passed Create snapshot of a vGPU VM on ESX'
insertafter: EOF
when: taskresult|succeeded
delegate_to: localhost
vcenter_snaprestore.yml
***********************************************
- hosts: esx1
become: true
roles:
- ESX_VM_SnapRestore
**********************************
vmisra@ubuntu:/etc/ansible$ ansible-playbook vcenter_snaprestore.yml
Do you see any reason for sudo: a Password required error message.
Thanks,
Vijay
"I am trying to use ansible as a test tool. at the end of each sucess/faiure i want to append a string at the end of a file and this file can be used as a test report.
i Have tried this code but it did not log anything in the file."
This sounds like a good use for a callback plugin. A custom callback plugin could append to a file on *_ok/*_fail callbacks.
I would base it around the python 'logging' module, but it could be something simpler.
The 'junit' callback might be a good example and could possibly be used directly if a junit.xml file is useful for your test tool.
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/w9XT01E6i6Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@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/CAOJNLf_RvPT%3D1josShCApQ94qrkZWAdU5KD%2BM8BZL_LvzsJAfA%40mail.gmail.com.
--
Kai Stian Olstad
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/w9XT01E6i6Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@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/03c60156148a083a08ccde6afdca9646%40olstad.com.