Re: [ansible-project] Unable to print regex registered variable in Ansible

2020-01-15 Thread Kai Stian Olstad
On 15.01.2020 06:34, Shifa Shaikh wrote: I wish to search for all entries of string starting with "SSLFile" or starting with "SSLFile" in a file(httpd.conf) and register it to a variable and print all the matches found. The string is found as evident from the output and the file is not modified

Re: [ansible-project] Unable to print regex registered variable in Ansible

2020-01-15 Thread Jean-Yves LENHOF
Not undestanding exactly what you want to achieve... For the syntax error you forgot a quote So instead of this target: "{{ input | regex_replace('\\sSSLFile.*, '\\1') }}" You need this target: "{{ input | regex_replace('\\sSSLFile.*' , '\\1') }}" Regards, Le 15 janvier 2020 08:59:32

Re: [ansible-project] Unable to print regex registered variable in Ansible

2020-01-15 Thread Dick Visser
On Wed, 15 Jan 2020 at 06:35, Shifa Shaikh wrote: > > I wish to search for all entries of string starting with "SSLFile" or > starting with "SSLFile" in a file(httpd.conf) and register it to > a variable and print all the matches found. It's not entirely clear what you mean by this. Can you

Re: [ansible-project] Unable to print regex registered variable in Ansible

2020-01-15 Thread Shifa Shaikh
Reading the contents of the file is not the challenge. I used both sllurp as well as cat and I can see the file contents in the debug. The error occurs when I regex for the desired string. - name: Slurp certificate entries slurp: src: "{{ httpd_home }}/conf/httpd.conf"

Re: [ansible-project] Unable to print regex registered variable in Ansible

2020-01-14 Thread Jean-Yves LENHOF
Hi, Perhaps you should better use slurp module to register the content of the file and do some regexp to print what you want on it... https://docs.ansible.com/ansible/latest/modules/slurp_module.html#slurp-module Regards, Le 15/01/2020 à 06:34, Shifa Shaikh a écrit : I wish to search for

[ansible-project] Unable to print regex registered variable in Ansible

2020-01-14 Thread Shifa Shaikh
I wish to search for all entries of string starting with "SSLFile" or starting with "SSLFile" in a file(httpd.conf) and register it to a variable and print all the matches found. The string is found as evident from the output and the file is not modified which is good; but I'm unable to print