i figured out the issue. I added some print statements during python module 
troubleshooting and looks Ansible didn't like that. I commented out the 
print statements and ansible is happy now.



On Wednesday, February 24, 2016 at 10:35:25 AM UTC-8, Hongjun Ma wrote:
>
> Hello, my own python module returned the following failure when running 
> from ansible. 
>
>
> {"msg": "Created profile", "changed": true, "ansible_facts": 
> {"serial_number": .......... "created": true}}
>
> FATAL: all hosts have already failed -- aborting
>
> PLAY RECAP 
> ******************************************************************** 
>            to retry, use: --limit @/home/hongjun/ov_site.retry
>
> demo-web1                  : ok=0    changed=0    unreachable=0   
>  failed=1  
>
> I trimmed ansible_facts msg for readability. I don't understand where 
> ansible is complaining about. My python module successfully finished the 
> task at the end system. If I keep Ansible temp python file and trace 
> directly from Pycharm, I can see the call is returned successfully from my 
> module to ansible exit_json function with all information passed correctly. 
>
>
>     def exit_json(self, **kwargs):
>         ''' return from the module, without error '''
>         self.add_path_info(kwargs)
>         if not 'changed' in kwargs:
>             kwargs['changed'] = False
>         self.do_cleanup_files()
>         print self.jsonify(kwargs)
>         sys.exit(0)
>
> My charm returned with exit code 0
> Process finished with exit code 0
>
> The playbook has a simple task calling my module ov_server, inventory only 
> has one host defined. Python is 2.7.11
>
>  - name: Create Server Profiles
>    ov_server:
>      oneview_host: "{{ oneview }}"
>      username: "{{ ov_username }}"
>      password: "{{ ov_password }}"
>      server_template: "{{ ov_template }}"
>      name: "{{ inventory_hostname }}"
>    delegate_to: localhost
>
>
>
>

-- 
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+unsubscr...@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/758b784d-7cd2-452d-b778-f9e58d1366e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to