标签:distrib blank mil hat ansi cond 写法 参考 举例
- hosts: all
tasks:
- include: Ubuntu.yml
when: ansible_os_family == "Ubuntu"
- include: RHEL.yml
when: ansible_os_family == "RedHat"
When: condition1 and/or condition2
when:
ansible_distribution in [‘RedHat‘, ‘CentOS‘, ‘ScientificLinux‘] and
(ansible_distribution_version|version_compare(‘7‘, ‘<‘) or
ansible_distribution_version|version_compare(‘8‘, ‘>=‘))
or
ansible_distribution == ‘Fedora‘
or
ansible_distribution == ‘Ubuntu‘ and
ansible_distribution_version|version_compare(‘15.04‘, ‘>=‘)
and 还有一种写法,这种写法更简洁
when:
- ansible_distribution in [‘RedHat‘, ‘CentOS‘, ‘ScientificLinux‘]
- ansible_distribution_version|version_compare(‘15.04‘, ‘>=‘)
标签:distrib blank mil hat ansi cond 写法 参考 举例
原文地址:https://www.cnblogs.com/hiyang/p/14455143.html