Ansible创建具有固定IP的GCE节点

2024-04-28 16:06:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用ansible创建一个GCE节点并附加一个固定IP。我的问题是ansible似乎没有这个选择的目的。在

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

如果有人有主意?在


Tags: 实例代码目的ip节点源代码部署google
1条回答
网友
1楼 · 发布于 2024-04-28 16:06:03

我没有在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

我对add external_ips选项提出了一个请求:PR #539

相关问题 更多 >