This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.5.4.4.3. 发送至 Ansible 的额外变量
额外变量可发送至 Ansible,然后由 Operator 管理。自定义资源 (CR) 的 spec
部分作为额外变量按照键值对传递。等同于传递给 ansible-playbook
命令的额外变量。
Operator 还会在 meta
字段下传递额外变量,用于 CR 的名称和 CR 的命名空间。
对于以下 CR 示例:
作为额外变量传递至 Ansible 的结构为:
message
和 newParameter
字段在顶层被设置为额外变量,meta
则为 Operator 中定义的 CR 提供相关元数据。meta
字段可使用 Ansible 中的点符号来访问,如:
--- - debug: msg: "name: {{ ansible_operator_meta.name }}, {{ ansible_operator_meta.namespace }}"
---
- debug:
msg: "name: {{ ansible_operator_meta.name }}, {{ ansible_operator_meta.namespace }}"