I am running into a problem the gce module. I suspect it has something to do with my environment. Any tips to further troubleshoot this would be welcome.
I am running ansible from git (as of a couple of days ago), and using libcloud 0.14.0. I know there was an issue with the beta3 of libcloud - but I think this version is newer (and the error I get is different anyways…). I have followed the thread on how to set up secrets.py, set GCE_PARAMS, etc. I think I have that part correct - but the error shows up no matter the contents of secrets.py - making me think it doesnt even get to that point.
My playbook looks like (ignore extra line breaks - that is an artifact of cut n paste)
- name: Create a sandbox instance
hosts: localhost
connection: local
vars:
names: foo,bar
machine_type: f1-micro
image: centos-6-v20131120
zone: us-central1-a
tasks:
- name: Launch instances
local_action: gce machine_type={{machine_type}} image={{image}} zone={{zone}}
The error I get is “AttributeError: ‘exceptions.ValueError’ object has no attribute ‘http_code’”
The full output is below:
PLAY [Create a sandbox instance] **********************************************
GATHERING FACTS ***************************************************************
REMOTE_MODULE setup
<127.0.0.1> REMOTE_MODULE setup
EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1391701320.38-99585849597022 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1391701320.38-99585849597022 && echo $HOME/.ansible/tmp/ansible-tmp-1391701320.38-99585849597022’]
<127.0.0.1> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1391701320.39-156688493018489 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1391701320.39-156688493018489 && echo $HOME/.ansible/tmp/ansible-tmp-1391701320.39-156688493018489’]
PUT /var/folders/j6/q_tyq95n1zzf_v68908mpxy40000gn/T/tmpZVDeOO TO /Users/warren/.ansible/tmp/ansible-tmp-1391701320.38-99585849597022/setup
EXEC [‘/bin/sh’, ‘-c’, ‘/usr/bin/python /Users/warren/.ansible/tmp/ansible-tmp-1391701320.38-99585849597022/setup; rm -rf /Users/warren/.ansible/tmp/ansible-tmp-1391701320.38-99585849597022/ >/dev/null 2>&1’]
<127.0.0.1> PUT /var/folders/j6/q_tyq95n1zzf_v68908mpxy40000gn/T/tmp6yDJfN TO /Users/warren/.ansible/tmp/ansible-tmp-1391701320.39-156688493018489/setup
<127.0.0.1> EXEC [‘/bin/sh’, ‘-c’, ‘/usr/bin/python /Users/warren/.ansible/tmp/ansible-tmp-1391701320.39-156688493018489/setup; rm -rf /Users/warren/.ansible/tmp/ansible-tmp-1391701320.39-156688493018489/ >/dev/null 2>&1’]
ok: [127.0.0.1]
ok: [localhost]
TASK: [Launch instances] ******************************************************
<127.0.0.1> REMOTE_MODULE gce machine_type=f1-micro image=centos-6-v20131120 zone=us-central1-a
<127.0.0.1> REMOTE_MODULE gce machine_type=f1-micro image=centos-6-v20131120 zone=us-central1-a
<127.0.0.1> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1391701320.97-214772578621431 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1391701320.97-214772578621431 && echo $HOME/.ansible/tmp/ansible-tmp-1391701320.97-214772578621431’]
<127.0.0.1> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1391701320.97-169496415593167 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1391701320.97-169496415593167 && echo $HOME/.ansible/tmp/ansible-tmp-1391701320.97-169496415593167’]
<127.0.0.1> PUT /var/folders/j6/q_tyq95n1zzf_v68908mpxy40000gn/T/tmpskK1WM TO /Users/warren/.ansible/tmp/ansible-tmp-1391701320.97-169496415593167/gce
<127.0.0.1> PUT /var/folders/j6/q_tyq95n1zzf_v68908mpxy40000gn/T/tmp1KTB82 TO /Users/warren/.ansible/tmp/ansible-tmp-1391701320.97-214772578621431/gce
<127.0.0.1> EXEC [‘/bin/sh’, ‘-c’, ‘/usr/bin/python /Users/warren/.ansible/tmp/ansible-tmp-1391701320.97-169496415593167/gce; rm -rf /Users/warren/.ansible/tmp/ansible-tmp-1391701320.97-169496415593167/ >/dev/null 2>&1’]
<127.0.0.1> EXEC [‘/bin/sh’, ‘-c’, ‘/usr/bin/python /Users/warren/.ansible/tmp/ansible-tmp-1391701320.97-214772578621431/gce; rm -rf /Users/warren/.ansible/tmp/ansible-tmp-1391701320.97-214772578621431/ >/dev/null 2>&1’]
failed: [127.0.0.1] => {“failed”: true, “parsed”: false}
invalid output was: Traceback (most recent call last):
File “/Users/warren/.ansible/tmp/ansible-tmp-1391701320.97-214772578621431/gce”, line 1462, in
main()
File “/Users/warren/.ansible/tmp/ansible-tmp-1391701320.97-214772578621431/gce”, line 376, in main
module.fail_json(msg=unexpected_error_msg(e), changed=False)
File “/Users/warren/.ansible/tmp/ansible-tmp-1391701320.97-214772578621431/gce”, line 191, in unexpected_error_msg
error.http_code, error.code, str(error.value))
AttributeError: ‘exceptions.ValueError’ object has no attribute ‘http_code’
failed: [localhost] => {“failed”: true, “parsed”: false}
invalid output was: Traceback (most recent call last):
File “/Users/warren/.ansible/tmp/ansible-tmp-1391701320.97-169496415593167/gce”, line 1462, in
main()
File “/Users/warren/.ansible/tmp/ansible-tmp-1391701320.97-169496415593167/gce”, line 376, in main
module.fail_json(msg=unexpected_error_msg(e), changed=False)
File “/Users/warren/.ansible/tmp/ansible-tmp-1391701320.97-169496415593167/gce”, line 191, in unexpected_error_msg
error.http_code, error.code, str(error.value))
AttributeError: ‘exceptions.ValueError’ object has no attribute ‘http_code’
FATAL: all hosts have already failed – aborting