Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Ansible中调用架构事实?_Ansible - Fatal编程技术网

如何在Ansible中调用架构事实?

如何在Ansible中调用架构事实?,ansible,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", 您可以这

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

$ 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", 
您可以这样做(这对任何事情都有效):

或者(这仅适用于Debian):

返回值为:

由于历史原因,可能有不同的系统使用不同的名称调用相同的体系结构:

你可以做(这适用于所有事情):

或者(这仅适用于Debian):

返回值为:

由于历史原因,可能有不同的系统使用不同的名称调用相同的体系结构:


ansible\u架构
返回
x86\u 64
。这是什么有趣的架构名称?
ansible\u架构
返回
x86\u 64
。这是什么有趣的建筑名称?
ansible HOST -m setup -a 'filter=ansible_architecture'
- name: Get DEB architecture
  shell: dpkg --print-architecture
  register: deb_architecture

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