1--- 2- debug: msg="START cli/error_regex.yaml on connection={{ ansible_connection }}" 3 4- block: 5 - name: clear logs 1 6 cli_command: &clear_logs 7 command: clear logging 8 prompt: 9 - Clear logging buffer 10 answer: 11 - "\r" 12 ignore_errors: True 13 14 - name: increase log buffer size 15 cli_config: 16 config: logging buffered 9600000 17 18 - name: send log with error regex match 1 19 cli_command: &send_logs 20 command: "send log 'IPSEC-3-REPLAY_ERROR: test log_1'\n" 21 ignore_errors: True 22 23 - name: pause to avoid rate limiting-1 24 pause: 25 seconds: 20 26 27 - name: fetch logs without command specific error regex 28 ios_command: 29 commands: 30 - show logging 31 register: result 32 ignore_errors: True 33 34 - name: ensure task fails due to mismatched regex 35 assert: 36 that: 37 - "result.failed == true" 38 39 - name: pause to avoid rate limiting-2 40 pause: 41 seconds: 20 42 43 - name: clear logs 2 44 cli_command: *clear_logs 45 ignore_errors: True 46 47 - name: send log with error regex match 2 48 cli_command: *send_logs 49 ignore_errors: True 50 51 - name: fetch logs with command specific error regex 52 ios_command: 53 commands: 54 - show logging 55 register: result 56 vars: 57 ansible_terminal_stderr_re: 58 - pattern: 'connection timed out' 59 flags: 're.I' 60 61 - name: ensure task with modified error regex is success 62 assert: 63 that: 64 - "result.failed == false" 65 when: ansible_connection == 'network_cli' 66 67- debug: msg="END cli/error_regex.yaml on connection={{ ansible_connection }}" 68