我正在使用Ansible/Ansible Tower,並想確定Windows主機上有哪些可用的事實。該documentation狀態,我可以運行以下命令:Ansible - 從遠程Windows主機獲取事實
ansible hostname -m setup
我將如何納入一個劇本,我從塔運行這個,所以我可以收集來自主機的相關信息?
這裏是按所給的援助,目前的劇本:
# 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
哪裏輸出顯示/我怎麼得到這個輸出? – Kode
@Kode看到我的更新。 – helloV
有沒有辦法輸出大的列表,所以我知道變量是什麼?在他們的例子中,它提供了大量的Ubuntu輸出。有了這些列表,我現在可以知道我可以用作變量了。這裏列出了一個fact_path,但不確定這是如何工作在劇本中http://docs.ansible.com/ansible/setup_module.html – Kode