init
This commit is contained in:
commit
c5cd492449
475 changed files with 27928 additions and 0 deletions
42
technology/tools/Ansible/modules/ansible.builtin.assert.md
Normal file
42
technology/tools/Ansible/modules/ansible.builtin.assert.md
Normal file
|
@ -0,0 +1,42 @@
|
|||
# ansible.builtin.assert
|
||||
This module asserts that given expressions are true with an optional custom message
|
||||
|
||||
## Parameters
|
||||
| Parameter | Type | Description |
|
||||
| ----------- | --------------------------------- | ---------------------------------------------------------------------------------------- |
|
||||
| **fail_msg** | string | The customized message used for a failing assertion |
|
||||
| **quiet** | boolean | Set this to `true` to avoid verbose output |
|
||||
| **success_msg** | string | The customized message used for a successful assertion |
|
||||
| **that** | list / elements=string / required | A list of string expressions of the same form that can be passed to the ‘when’ statement |
|
||||
|
||||
## Examples
|
||||
```yaml
|
||||
- ansible.builtin.assert: { that: "ansible_os_family != 'RedHat'" }
|
||||
|
||||
- ansible.builtin.assert:
|
||||
that:
|
||||
- "'foo' in some_command_result.stdout"
|
||||
- number_of_the_counting == 3
|
||||
|
||||
- name: After version 2.7 both 'msg' and 'fail_msg' can customize failing assertion message
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- my_param <= 100
|
||||
- my_param >= 0
|
||||
fail_msg: "'my_param' must be between 0 and 100"
|
||||
success_msg: "'my_param' is between 0 and 100"
|
||||
|
||||
- name: Please use 'msg' when ansible version is smaller than 2.7
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- my_param <= 100
|
||||
- my_param >= 0
|
||||
msg: "'my_param' must be between 0 and 100"
|
||||
|
||||
- name: Use quiet to avoid verbose output
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- my_param <= 100
|
||||
- my_param >= 0
|
||||
quiet: true
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue