首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用proxmox建立动态库存

用proxmox建立动态库存
EN

Stack Overflow用户
提问于 2022-11-14 12:33:00
回答 1查看 63关注 0票数 0

我对Proxmox生成的动态库存有问题。我已经创建了一个inventory.proxmox.yml文件。这包含以下配置:

代码语言:javascript
复制
plugin: community.general.proxmox
url: https://MyIP:8006
user: ansible@pve
password: my_password
validate_certs: false
want_proxmox_nodes_ansible_host: false

在接下来的步骤中,我想创建清单。为此,我将采取以下行动:

代码语言:javascript
复制
ansible-inventory -i inventory.proxmox.yml --list

执行后,我会收到以下错误:

代码语言:javascript
复制
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:1015: InsecureRequestWarning: Unverified HTTPS request is being made to host 'myIP'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  warnings.warn(
[WARNING]:  * Failed to parse /home/user/ansible/inventory/inventory.proxmox.yml with auto plugin: 'NoneType' object is not subscriptable
[WARNING]:  * Failed to parse /home/user/ansible/inventory/inventory.proxmox.yml with yaml plugin: Plugin configuration YAML file, not YAML inventory
[WARNING]:  * Failed to parse /home/user/ansible/inventory/inventory.proxmox.yml with ini plugin: Invalid host pattern 'plugin:' supplied, ending in ':' is not
allowed, this character is reserved to provide a port.
[WARNING]:  * Failed to parse /home/user/ansible/inventory/inventory.proxmox.yml with ansible_collections.community.general.plugins.inventory.proxmox plugin:
'NoneType' object is not subscriptable
[WARNING]: Unable to parse /home/user/ansible/inventory/inventory.proxmox.yml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available

将yml-文件中的"url: https“更改为"http”确实可以消除https-错误。但是,proxmox没有监听http。

EN

回答 1

Stack Overflow用户

发布于 2022-11-16 18:31:11

我也有过类似的问题:

代码语言:javascript
复制
[WARNING]:  * Failed to parse pve.yml with auto plugin: inventory source 'pve.yml' could not be verified by inventory plugin 'community.general.proxmox'
[WARNING]:  * Failed to parse pve.yml with yaml plugin: Plugin configuration YAML file, not YAML inventory
[WARNING]:  * Failed to parse pve.yml with ini plugin: Invalid host pattern 'plugin:' supplied, ending in ':' is not allowed, this character is reserved to provide a port.
[WARNING]: Unable to parse pve.yml as an inventory source
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
[WARNING]: Could not match supplied host pattern, ignoring: pve

事实证明,这个问题很愚蠢,而且出乎意料。我进入了模块本身的代码,发现如下:

代码语言:javascript
复制
self.display.vvv('Skipping due to inventory source not ending in "proxmox.yaml" nor "proxmox.yml"')

在我的例子中,带有结束*.proxmox.yml的所有选项都不起作用(例如,my.proxmox.yml)。所以我把我的库存文件重命名为proxmox.yml,它起作用了。我的存货:

代码语言:javascript
复制
plugin: community.general.proxmox
url: https://my.pve.host:8006
user: ansible-prov@pve
token_id: ansible
token_secret: <token>
validate_certs: false
want_proxmox_nodes_ansible_host: false
compose:
  ansible_host: proxmox_ipconfig0.ip | default(proxmox_net0.ip) | ipaddr('address')
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74431714

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档