My regex can fetch the correct word; however, the ansible fails to change it enter image description here
My ansible code:
hosts: all
gather_facts: False
become: true
tasks:
- name: Checking if chargen configuration is present in the files
ansible.builtin.replace:
path: /etc/xinetd.d/chargen
regexp: '(?<=disable\s{9}\S\s)yes'
replace: 'no'
register: test
- name: Gathered
ansible.builtin.debug:
msg: "{{ test }}"
Result: it's "ok" but not changed