我正在寻找事实,其中包含以下信息:
$ 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",
Using ansible.builtin.shell
这是一个坏主意。因为它每次都会改变状态。我建议使用映射可靠的事实 https://docs.ansible.com/ansible/latest/user_guide/playbooks_vars_facts.html.
---
vars:
deb_architecture: {
"aarch64": "arm64",
"x86_64": "amd64"
}
tasks:
- name: Debug message
ansible.builtin.debug:
msg: "{{ [ansible_architecture] | map('extract', deb_architecture) | first }}"
# like example add docker repo
- name: Add Docker APT repository
ansible.builtin.apt_repository:
repo: deb [arch={{ [ansible_architecture] | map('extract', deb_architecture) | first }}] https://download.docker.com/{{ ansible_system | lower }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)