forked from lorin/ansiblebook
-
Notifications
You must be signed in to change notification settings - Fork 338
When
Bas edited this page Feb 27, 2023
·
2 revisions
An optional conditional statement attached to a task that is used to determine if the task should run or not. If the expression following the when: keyword evaluates to false, the task will be ignored. Multiple AND clauses can be listed, logical operators work as expected.
- name: Apply STRICT hardening for sshd
when:
- crypto_policy == 'STRICT'
- distro_version is defined
- distro_version in [ 'RedHat8', 'CentOS8','Debian11','Rocky8']
include_tasks: "strict_config.yml"
- name: Apply STRICT hardening for sshd
when:
- crypto_policy == 'STRICT'
- distro_version is not defined
- distro_version not in [ 'RedHat8', 'CentOS8','Debian11','Rocky8']
include_tasks: sshd_crypto.yml