我想根据分布创建变量,以下代码不起作用,我不知道原因:
- name: Get Release
vars: release: xenial
when: (ansible_distribution_release == 'qiana') or
(ansible_distribution_release == 'rebecca') or
(ansible_distribution_release == 'rafaela') or
(ansible_distribution_release == 'rosa')
答案 0 :(得分:4)
以下代码不起作用,我不知道为什么
因为没有名为vars
的模块。
您可以使用set_fact module:
执行此操作- name: Get Release
set_fact:
release: xenial
when: (ansible_distribution_release == 'qiana') or
(ansible_distribution_release == 'rebecca') or
(ansible_distribution_release == 'rafaela') or
(ansible_distribution_release == 'rosa')