ansible.builtin.replace – Replace all instances of a ...
docs.ansible.com › builtin › replace_module-name: Before Ansible 2.3, option 'dest', 'destfile' or 'name' was used instead of 'path' ansible.builtin.replace: path: /etc/hosts regexp: '(\s+)old\.host\.name(\s+.*)?$' replace: '\1new.host.name\2'-name: Replace after the expression till the end of the file (requires Ansible >= 2.4) ansible.builtin.replace: path: /etc/apache2/sites-available/default.conf after: 'NameVirtualHost [*]' regexp: '^(.+)$' replace: '# \1'-name: Replace before the expression till the begin of the file (requires ...