| 1 |
--- |
| 2 |
- name: test - do not run tests with < Zabbix 4.0 |
| 3 |
meta: end_play |
| 4 |
when: zabbix_version is version('4.0', '<') |
| 5 |
|
| 6 |
- when: zabbix_version is version('6.0', '<') |
| 7 |
name: Unsupport Zabbix version (<6.0) |
| 8 |
block: |
| 9 |
- name: test - fail to update regexp setting |
| 10 |
community.zabbix.zabbix_regexp: |
| 11 |
name: File systems for discovery |
| 12 |
test_string: ext3 |
| 13 |
expressions: |
| 14 |
- expression: "^(btrfs|ext2|ext3|ext4|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|ntfs|fat32|zfs)$" |
| 15 |
- expression_type: result_is_true |
| 16 |
ignore_errors: true |
| 17 |
register: zbxauth_update |
| 18 |
|
| 19 |
- ansible.builtin.assert: |
| 20 |
that: zbxauth_update.failed is sameas True |
| 21 |
|
| 22 |
- when: zabbix_version is version('6.0', '>=') |
| 23 |
name: support Zabbix version (>=6.0) |
| 24 |
block: |
| 25 |
- name: test - try to update regexp (present) |
| 26 |
community.zabbix.zabbix_regexp: |
| 27 |
name: File systems for discovery |
| 28 |
test_string: ext3 |
| 29 |
expressions: |
| 30 |
- expression: "^(btrfs|ext2|ext3|ext4|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|ntfs|fat32|zfs)$" |
| 31 |
expression_type: result_is_true |
| 32 |
register: zbxregexp_update |
| 33 |
|
| 34 |
- name: assert that regexp was NOT updated |
| 35 |
ansible.builtin.assert: |
| 36 |
that: |
| 37 |
- zbxregexp_update.changed is sameas False |
| 38 |
|
| 39 |
- name: test - try to delete regexp |
| 40 |
community.zabbix.zabbix_regexp: |
| 41 |
name: File systems for discovery |
| 42 |
state: absent |
| 43 |
register: zbxregexp_update |
| 44 |
|
| 45 |
- name: assert that regexp was deleted |
| 46 |
ansible.builtin.assert: |
| 47 |
that: |
| 48 |
- zbxregexp_update.changed is sameas True |
| 49 |
- zbxregexp_update.msg == "Successfully deleted regular expression setting." |
| 50 |
|
| 51 |
- name: test - try to create regexp |
| 52 |
community.zabbix.zabbix_regexp: |
| 53 |
name: File systems for discovery |
| 54 |
test_string: ext3 |
| 55 |
expressions: |
| 56 |
- expression: "^(btrfs|ext2|ext3|ext4|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|ntfs|fat32|zfs)$" |
| 57 |
expression_type: result_is_true |
| 58 |
register: zbxregexp_update |
| 59 |
|
| 60 |
- name: assert that regexp was created |
| 61 |
ansible.builtin.assert: |
| 62 |
that: |
| 63 |
- zbxregexp_update.changed is sameas True |
| 64 |
- zbxregexp_update.msg == "Successfully created regular expression setting." |
| 65 |
|
| 66 |
- name: test - try to update regexp |
| 67 |
community.zabbix.zabbix_regexp: |
| 68 |
name: File systems for discovery |
| 69 |
test_string: ext3 |
| 70 |
expressions: |
| 71 |
- expression: "create" |
| 72 |
expression_type: character_string_included |
| 73 |
- expression: "update/delete" |
| 74 |
expression_type: any_character_string_included |
| 75 |
case_sensitive: true |
| 76 |
exp_delimiter: "/" |
| 77 |
- expression: "failed" |
| 78 |
expression_type: character_string_not_included |
| 79 |
- expression: "^(btrfs|ext2|ext3|ext4|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|ntfs|fat32|zfs)$" |
| 80 |
expression_type: result_is_true |
| 81 |
- expression: "regexp" |
| 82 |
expression_type: result_is_false |
| 83 |
register: zbxregexp_update |
| 84 |
|
| 85 |
- name: assert that regexp was updated |
| 86 |
ansible.builtin.assert: |
| 87 |
that: |
| 88 |
- zbxregexp_update.changed is sameas True |
| 89 |
- zbxregexp_update.msg == "Successfully updated regular expression setting." |
| 90 |
|
| 91 |
- name: test - try to update regexp (will not update) |
| 92 |
community.zabbix.zabbix_regexp: |
| 93 |
name: File systems for discovery |
| 94 |
test_string: ext3 |
| 95 |
expressions: |
| 96 |
- expression: "update/delete" |
| 97 |
expression_type: any_character_string_included |
| 98 |
case_sensitive: true |
| 99 |
exp_delimiter: "/" |
| 100 |
- expression: "create" |
| 101 |
expression_type: character_string_included |
| 102 |
- expression: "failed" |
| 103 |
expression_type: character_string_not_included |
| 104 |
- expression: "^(btrfs|ext2|ext3|ext4|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|ntfs|fat32|zfs)$" |
| 105 |
expression_type: result_is_true |
| 106 |
- expression: "regexp" |
| 107 |
expression_type: result_is_false |
| 108 |
register: zbxregexp_update |
| 109 |
|
| 110 |
- name: assert that regexp was updated |
| 111 |
ansible.builtin.assert: |
| 112 |
that: |
| 113 |
- zbxregexp_update.changed is sameas False |
| 114 |
|
| 115 |
- name: Initialize File systems for discovery |
| 116 |
community.zabbix.zabbix_regexp: |
| 117 |
name: File systems for discovery |
| 118 |
test_string: ext3 |
| 119 |
expressions: |
| 120 |
- expression: "^(btrfs|ext2|ext3|ext4|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|ntfs|fat32|zfs)$" |
| 121 |
expression_type: result_is_true |
| 122 |
register: zbxregexp_update |