Hi Thanks for getting back to me.
I managed to get the snapshot to work yesterday. I have to use the guest server name and UUID which is a bit of pain.
 
I am using the latest version of Ansible I try my best to find the latest version of any of the modules and add-on's
 
I am not sure who maintains these modules documentation but it really needs to be update so the information that is provided is correct. As I say the only way I was able to get it to work was I had to use the UUID for the VM Guest.
 
I also wanted to use Register to output some information to a file and that failed using the VMware_guest_facts Module. 
 
Can you point me to the folks who maintain these modules. I would like to get some further help. I have tried some the blogs but not much help there.
 
I do not want to bog you down with questions if you are not working with the modules.
 
I do really appreciate you getting back to me, it hard floundering  around in the dark. While there are a lot of resources out on the web there is so much sometimes that it makes it hard to figure out what is correct and what is not.
 
I will stop dribbling now. thanks again.
 
If you do have any really good blogs or web links I would really appreciate it..
 
regards,
 
Richg
 
 
On Tue, Apr 25, 2017 at 03:44 AM, 'J Hawkesworth' via Ansible Project wrote:
 
 
Hi,
I don't have a straightforward answer for you, but I have some suggestions. Firstly I think the vmware_... modules are the ones getting the most attention, so if you can use the vmware_... ones, instead of vsphere_guest you are less likely to have to change things in future.  I haven't used these modules a lot but I have had it working from our EL 7.3 boxes.  One potential difference between your set up and mine is that I installed pyvmomi from pip, rather than the EL packages.  My guess  is you have some version mismatch between the various libs you have installed.  My usual fix for that is to prune platform packages and reinstall latest versions. Also, you don't mention which ansible version you are using, but if you are just starting out, there's no reason not to go straight to most-recently-released ansible 2.3 which will have latest and greatest versions of the vmware modules included (and will most closely match documentation).
Sorry its a bit vague but hope the above is some help,
Jon

On Tuesday, April 25, 2017 at 6:39:06 AM UTC+1, [email protected] wrote: Hi Thanks for replying the main problem I am having it I get this when I run my scripts:   msg": "pysphere module required
I would like to ask if you have used the vmware modules with Ansible?
I am running into quite a few issues with the mods. I was trying today to run the vmware_guest_facts mod I wanted to send the output to a file to review. and here is the results I get back:


The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_2bNLuB/ansible_module_vmware_guest_facts.py", line 215, in <module>
    main()
  File "/tmp/ansible_2bNLuB/ansible_module_vmware_guest_facts.py", line 202, in main
    uuid=module.params['uuid'])
  File "/tmp/ansible_2bNLuB/ansible_module_vmware_guest_facts.py", line 122, in getvm
    vm = find_vm_by_id(self.content, vm_id=uuid, vm_id_type="uuid")
  File "/tmp/ansible_2bNLuB/ansible_modlib.zip/ansible/module_utils/vmware.py", line 158, in find_vm_by_id   File "/usr/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 580, in <lambda>
    self.f(*(self.args + (obj,) + args), **kwargs)
  File "/usr/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 385, in _InvokeMethod
    list(map(CheckField, info.params, args))
  File "/usr/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 915, in CheckField     raise TypeError('Required field "%s" not provided (not @optional)' % info.name <http://info.name> )
TypeError: Required field "uuid" not provided (not @optional)


fatal: [localhost -> localhost]: FAILED! => {
    "changed": false, 
    "failed": true, 
    "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_2bNLuB/ansible_module_vmware_guest_facts.py\", line 215, in <module>\n    main()\n  File \"/tmp/ansible_2bNLuB/ansible_module_vmware_guest_facts.py\", line 202, in main\n    uuid=module.params['uuid'])\n  File \"/tmp/ansible_2bNLuB/ansible_module_vmware_guest_facts.py\", line 122, in getvm\n    vm = find_vm_by_id(self.content, vm_id=uuid, vm_id_type=\"uuid\")\n  File \"/tmp/ansible_2bNLuB/ansible_modlib.zip/ansible/module_utils/vmware.py\", line 158, in find_vm_by_id\n  File \"/usr/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py\", line 580, in <lambda>\n    self.f(*(self.args + (obj,) + args), **kwargs)\n  File \"/usr/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py\", line 385, in _InvokeMethod\n    list(map(CheckField, info.params, args))\n  File \"/usr/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py\", line 915, in CheckField\n    raise TypeError('Required field \"%s\" not provided (not @optional)' % info.name <http://info.name> )\nTypeError: Required field \"uuid\" not provided (not @optional)\n", 
    "module_stdout": "", 
    "msg": "MODULE FAILURE", 
    "rc": 0
On Sunday, April 23, 2017 at 8:12:28 PM UTC-4, [email protected] wrote:
Hi all,

I am pretty new to Ansible and I have been tasked with coming up with a playbook to do the following:
1. connect to our various VC's can create a snapshot of the servers
2. check if physical or virtual
3. verify which version of Red Hat we are running either 6 or 7 
4. Patch the server and any issues push the errors out to a file


Sounds pretty easy we have over 1000 Rhel servers in physical and virtual format. I am creating the playbook on a Red Hat 7 Server running Rhel7.3, ansible-.2.0.0.1, python-pysphere-0.1.8.1, python2-pyvmomi-6.5-1.


I already have my inventory of all my servers. Not an Issue
Ansible is running fine. Not an issue
python-pyvomomi. Appears to be running fine with certain mod's
Python-pysphere. Having issues with. 
1. is there a way to verify this is working (As I continue to get module required after each run)  2. Is there another way to create snapshots of the Virtual Machines  ( We are running Vmware 6.2 right now)


Here is a simple script and the results.

- hosts: localhost
    tasks:
     - vsphere_guest:
         vcenter_hostname: virtualCenterName
         username: someuser
         password: somepassword
         guest: servername
         vmware_guest_facts: yes


This is my results:

fatal: [localhost]: FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "cluster": null, 
            "esxi": {}, 
            "force": false, 
            "from_template": null, 
            "guest": "soaiatapp01.gartner.com <http://soaiatapp01.gartner.com> ", 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "power_on_after_clone": true, 
            "resource_pool": null, 
            "snapshot_to_clone": null, 
            "state": "present", 
            "template_src": null, 
            "username": "gartner\\rgarrow-admin", 
            "validate_certs": true, 
            "vcenter_hostname": "vmwprtvcnp01.gartner.com <http://vmwprtvcnp01.gartner.com> ", 
            "vm_disk": {}, 
            "vm_extra_config": {}, 
            "vm_hardware": {}, 
            "vm_hw_version": null, 
            "vm_nic": {}, 
            "vmware_guest_facts": true
        }
    }, 
    "msg": "pysphere module required"


I am at a stand still for this so any help someone could pass on would be greatly appreciated. any references to Ansible and Red Hat would be helpful as well I have no problem reading information and learning new ways. There just does not seem to be a lot. I know if I was running ubuntu I would have not issues, plenty of info.. thanks.







--

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/-tcudFSuwNo/unsubscribe <https://groups.google.com/d/topic/ansible-project/-tcudFSuwNo/unsubscribe> .

To unsubscribe from this group and all its topics, send an email to [email protected] <mailto:[email protected]> .

To post to this group, send email to [email protected] <mailto:[email protected]> .

To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/552cd267-c088-4060-8306-505a7988c8f9%40googlegroups.com <https://groups.google.com/d/msgid/ansible-project/552cd267-c088-4060-8306-505a7988c8f9%40googlegroups.com?utm_medium=email&utm_source=footer> .

For more options, visit https://groups.google.com/d/optout <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/2d2a3431.72c3f.15ba60ff98b.Webtop.42%40optonline.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to