Ken*_*ace 10 vmware automation yaml redhat ansible
我正在学习红帽认证 Ansible 自动化专家 (EX407),并且正在研究no_log模块参数。我有一个这样结构的示例剧本;
---
- hosts: webservers
tasks:
- name: Query vCenter
vmware_guest:
hostname: "{{ vcenter['host'] }}"
username: "{{ vcenter['username'] }}"
password: "{{ vcenter['password'] }}"
name: "{{ inventory_hostname }}"
validate_certs: no
delegate_to: localhost
no_log: yes
...
Run Code Online (Sandbox Code Playgroud)
当no_log禁用时,我会获得很多有关虚拟机的有用调试信息,但是当no_log禁用时,我显然无法保护我的剧本保管数据(在本例中为 和vcenter['username']值vcenter['password'])。启用会使no_log我的剧本调试输出仅限于;
"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result",
Run Code Online (Sandbox Code Playgroud)
我想知道如何仅审查部分调试输出。我知道这是可能的,因为vcenter['password']无论我的状态如何,它的输出都会受到保护no_log。no_log当禁用时,我在详细输出中看到这一点;
"invocation": {
"module_args": {
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"username": "administrator@vsphere.local"
}
}
Run Code Online (Sandbox Code Playgroud)
你怎么看?
Ken*_*ace 10
因此,我深入研究了 VMWare 模块源代码,这就是我发现的内容。
password=dict(type='str',
aliases=['pass', 'pwd'],
required=False,
no_log=True,
fallback=(env_fallback, ['VMWARE_PASSWORD'])),
Run Code Online (Sandbox Code Playgroud)
看起来 Playbooks 并没有公开这个功能。VMWare 模块本身启用no_logPython 中的特定属性。就我而言,这只是 Playbook 隐藏的另一个功能。我真的希望抑制特定属性而不是整个模块成为标准,但这就是 Ansible 2.10 的情况。
| 归档时间: |
|
| 查看次数: |
17036 次 |
| 最近记录: |