Ansible中如何调用架构事实?

时间:2019-09-30 13:52:24

标签: ansible

我正在寻找包含以下信息的事实:

$ dpkg --print-architecture
amd64

我找不到它:

$ ansible host -m setup | grep amd64
        "BOOT_IMAGE": "/boot/vmlinuz-4.19.0-6-amd64", 
    "ansible_kernel": "4.19.0-6-amd64", 
        "BOOT_IMAGE": "/boot/vmlinuz-4.19.0-6-amd64", 

1 个答案:

答案 0 :(得分:0)

您可以做(这对所有事情都有效):

ansible HOST -m setup -a 'filter=ansible_architecture'

或者(仅在Debian上有效):

- name: Get DEB architecture
  shell: dpkg --print-architecture
  register: deb_architecture

- name: Print DEB architecture
  debug:
    msg: "deb_architecture.stdout: {{ deb_architecture.stdout }}"