Ansible Module ansible.builtin.assert
Jump to navigation
Jump to search
External
Internal
Overview
This module asserts that given expressions are true with an optional custom message.
- name: ...
assert:
that:
fail_msg:
success_msg:
Module Parameters
that
A list of string expressions of the same form that can be passed to the when
statement.
Use Cases
Ensure that a Directory Exists
- name: Gather stats on the given path
stat:
path: "{{ some_path }}"
register: some_path_info
- name: Ensure that some directory exist
assert:
that: "{{ some_path_info.stat.exists }}"
More details on the stat
module available here: