我有一个匹配某个单词后所有内容的正则表达式。当我在我的剧本中调用这个 pattern_match 时,我收到以下错误:
*ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to be in '/etc/ansible/REGEX.yml': line 12, column 6, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:*
show int bundle-ether 21 | inc clearing
- name: get time
^ here
代码如下:
---
- hosts: SCRING
gather_facts: true
connection: network_cli
tasks:
- name: show int | inc clearing
iosxr_command:
commands:
show int bundle-ether 21 | inc clearing
- name: get time
pattern_match:
regex: "(?<=counters ).*$"
export: yes
register: last
- debug:
msg: "{{ inventory_hostname }} counters last cleared - {{ last }}"