如何在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 }}"