【发布时间】:2020-10-22 22:34:34
【问题描述】:
我正在使用以下剧本从 ansible 调用 infoblox:
- hosts: localhost
gather_facts: false
tasks:
- name: Include infoblox_vault
include_vars:
file: 'infoblox_vault.yml'
- name: Install infoblox-client for DDI
pip:
name: infoblox-client
environment:
HTTP_PROXY: http://our_internal_proxy.net:8080
HTTPS_PROXY: http://our_internal_proxy.net:8080
delegate_to: localhost
- debug:
msg: can I decrypt username?--> "{{ vault_infoblox_username }}"
- name: Check if DNS Record exists
set_fact:
miqCreateVM_ddiRecord: "{{ lookup('nios', 'record:a', filter={'name': 'infoblox-devtest.net' }, provider={'host': 'ddi-qa.net', 'username': vault_infoblox_username, 'password': vault_infoblox_password }) }}"
- debug:
msg: check var miqCreateVM_ddiRecord "{{ miqCreateVM_ddiRecord }}"
- debug:
msg: test to see amazing vm_name! "{{ vm_name }}"
... code snipped
当作业运行时,我得到:
Vault password:
PLAY [localhost] ***************************************************************
TASK [Include infoblox_vault] **************************************************
ok: [127.0.0.1]
TASK [Install infoblox-client for DDI] *****************************************
ok: [127.0.0.1 -> localhost]
TASK [debug] *******************************************************************
ok: [127.0.0.1] => {
"msg": "can I decrypt username?--> \"manageiq-ddi\""
}
TASK [Check if DNS Record exists] **********************************************
fatal: [127.0.0.1]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'nios'. Error was a <type 'exceptions.Exception'>, original message: Infoblox IPAM is misconfigured: infoblox_username and infoblox_password are incorrect."}
PLAY RECAP *********************************************************************
127.0.0.1 : ok=3 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
这里是主要部分:"An unhandled exception occurred while running the lookup plugin 'nios'. Error was a <type 'exceptions.Exception'>, original message: Infoblox IPAM is misconfigured: infoblox_username and infoblox_password are incorrect."
这个剧本过去曾经奏效。我已经有几个月没有工作了。不知道为什么它坏了。
我确认我可以使用凭据手动登录 infoblox 客户端。我还尝试手动记录用户名以确保它从 ansible-vault 文件中解密凭据。那工作得很好。所以这不是凭证,不是保险库解密。这是另一回事。
我在网上找到了以下三个相关的主题,但似乎都没有解决问题:
This one (其中提到向请求添加证书。有人知道该怎么做吗?我找不到说明)
This one(提到升级问题。我向我们的网络人员展示了那篇文章中提到的版本,他们说版本号与我们环境中的内容完全不相关,因此很难评估这是否相关.)
Last one(它要求使用属性'http_request_timeout' : None,这不会让我觉得这是问题,因为我根本无法让它工作。)
有什么理论吗?谢谢!
【问题讨论】:
-
你可能想尝试增加 ansible 的详细程度(甚至是大锤
env ANSIBLE_DEBUG=1 ansible-playbook ...),看看你是否能得到真正的错误信息,和/或尝试运行 ansible 使用env https_proxy=http://our_internal_proxy.net:8080 ansible-playbook -c local ...以防lookup子进程无法访问代理 -
谢谢@mdaniel!我会试试的。
-
我赌的是选项 2(infoblox 客户端更新)。您说它几个月前可以工作,但是在您的剧本中,您在运行过滤器之前在本地安装了 latest infoblox-client。就是它,它被升级了,没有服务器端的东西。尝试在您的
pip任务中专门设置版本0.4.21。 -
感谢@guido,这很有启发性,即使修复是别的东西。我只是重建了 ansible 保险库文件,并在 ansible 中创建了一个新的凭证来配合它和 viola,它可以工作。
标签: ansible reserved-ip-addresses