8000 When · ansiblebook/ansiblebook Wiki · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
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
Clone this wiki locally
0