Я пытаюсь найти некоторые факты о моих удаленных ящиках в сборнике игр. Некоторые факты возвращают значение, а другие нет, даже если им присвоено значение.
Например, этот фрагмент кода получает имя удаленного хоста и версию дистрибутива RedHat:
- name: Get some info
debug:
msg:
- "The hostname is {{ ansible_hostname }}"
- "The REDHAT distribution is {{ ansible_distribution_version }}"
вывод:
TASK [Get some info]
******************************************************************************************
ok: [host-99] => {
"msg": [
"The hostname is host-99",
"The REDHAT distribution is 7.5"
]
}
Однако, если я добавлю еще один факт, скажем, ansible_product_serial, он не будет работать:
- name: Get some info
debug:
msg:
- "The hostname is {{ ansible_hostname }}"
- "The REDHAT distribution is {{ ansible_distribution_version }}"
- "The serial number is {{ ansible_product_serial }}"
Ошибка:
TASK [Get some info]
******************************************************************************************
fatal: [host-99]: FAILED! => {"msg": "The task includes an option with an undefined
variable. The error was: 'ansible_product_serial' is undefined\n\nThe error appears to be in
'/home/ansible/getInfo.yml': line 9, column 5, but may\nbe elsewhere in the file depending on
the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Get some info\n ^
here\n"}
Выполняется setup ad-ho c действительно предоставляет ansible_product_serial:
ansible host-99 -m setup | grep ansible_product_serial
"ansible_product_serial": "CZXXXXXXXXX",
Таким образом, кажется, что ansible_product_serial определен, но он не обнаружен.
Есть идеи?