我想创建一个带有ansible的GCE节点,并附加一个固定的IP。我的问题是 ansible 似乎没有这个选项的目的。
在谷歌搜索和搜索源代码后,我找不到部署实例的代码在哪里。
如果有人有想法?
我没有在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