我想用ansible创建一个GCE节点,并附加一个固定的IP。我的问题是ansible似乎没有用这个选项。
在谷歌搜索和搜索源代码后,我无法找到部署实例的代码在哪里。
如果有人有想法?
答案 0 :(得分:0)
我在ansible的源代码中找不到它,因为它位于ansible-modules-core。
在对一个坏区做出自愿错误之后,我有了这个追溯:
$ ansible-playbook create_vm.yml -i inventory/
PLAY [Create instance(s)] *****************************************************
TASK: [Launch instances] ******************************************************
failed: [localhost] => {"failed": true, "parsed": false}
Traceback (most recent call last):
File "/home/zulu/.ansible/tmp/ansible-tmp-1418774247.2-93981074391261/gce", line 2131, in <module>
main()
File "/home/zulu/.ansible/tmp/ansible-tmp-1418774247.2-93981074391261/gce", line 458, in main
module, gce, inames)
File "/home/zulu/.ansible/tmp/ansible-tmp-1418774247.2-93981074391261/gce", line 278, in create_instances
lc_machine_type = gce.ex_get_size(machine_type)
File "/usr/local/lib/python2.7/dist-packages/libcloud/compute/drivers/gce.py", line 2240, in ex_get_size
zone = self.ex_get_zone(zone)
File "/usr/local/lib/python2.7/dist-packages/libcloud/compute/drivers/gce.py", line 2333, in ex_get_zone
if name.startswith('https://'):
AttributeError: 'NoneType' object has no attribute 'startswith'
事实上,任务是由临时脚本/home/zulu/.ansible/tmp/ansible-tmp-1418774247.2-93981074391261/gce
启动的,在我的本地源代码中搜索后,我找到了它!
我搜索的代码最初存储在git子模块中:https://github.com/ansible/ansible/tree/devel/lib/ansible/modules
我已提出添加external_ips
选项的拉取请求:PR #539