diff --git a/roles/fail2ban/molecule/default/converge.yml b/roles/fail2ban/molecule/default/converge.yml index c0537ff..769c870 100644 --- a/roles/fail2ban/molecule/default/converge.yml +++ b/roles/fail2ban/molecule/default/converge.yml @@ -80,9 +80,10 @@ ansible.builtin.fail: msg: fail2ban accepted an ignoreip entry with whitespace rescue: - - name: The role refused the input - ansible.builtin.debug: - msg: Rejected as expected + - name: The role refused the input for the right reason + ansible.builtin.assert: + that: "'fail2ban_ignoreip must be' in ansible_failed_result.msg" + quiet: true # argument_specs accepts a plain string for a list option and leaves it a string, which would render one character per entry. # validate.yml refuses it; the verify step proves it never reached jail.local. @@ -100,9 +101,10 @@ ansible.builtin.fail: msg: fail2ban accepted a scalar string for fail2ban_ignoreip rescue: - - name: The role refused the input - ansible.builtin.debug: - msg: Rejected as expected + - name: The role refused the input for the right reason + ansible.builtin.assert: + that: "'fail2ban_ignoreip must be' in ansible_failed_result.msg" + quiet: true # A semicolon after whitespace starts an inline comment in Fail2Ban's config files, which would drop the rest of the ignoreip line # without an error, so validate.yml refuses it. The verify step proves it never reached jail.local. @@ -122,6 +124,7 @@ ansible.builtin.fail: msg: fail2ban accepted an ignoreip entry that starts with a semicolon rescue: - - name: The role refused the input - ansible.builtin.debug: - msg: Rejected as expected + - name: The role refused the input for the right reason + ansible.builtin.assert: + that: "'fail2ban_ignoreip must be' in ansible_failed_result.msg" + quiet: true