0

我想用 ansible 创建一个 GCE 节点并将其附加一个固定 IP。我的问题是 ansible 似乎没有针对此选项。

在谷歌搜索源代码后,我找不到部署实例的代码在哪里。

如果有人有想法?

4

1 回答 1

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

于 2014-12-17T00:03:41.137 回答