我正在使用Ansible / Ansible Tower,并希望确定我的Windows主机上有哪些事实可用。 文档指出我可以运行以下命令:
ansible hostname -m setup
我该如何将这个内容加入到我从Ansible Tower运行的playbook中,以便我可以从主机收集信息?
以下是根据给出的帮助编写的当前playbook:
# This play outputs the facts of the Windows targets in scope
- name: Gather Windows Facts
hosts: "{{ target }}"
gather_facts: yes
tasks:
- setup:
register: ansible_facts
- debug: item
with_dict: ansible_facts
然而,运行此代码会产生以下错误:
ERROR! this task 'debug' has extra params, which is only allowed in
the following modules: command, shell, script, include, include_vars,
add_host, group_by, set_fact, raw, meta
register: ansible_facts