I'm just trying with a dummy password. In the actual use case, the value 
will be read from config file which will be generated after user sets 
password. So I need to first get the password value in the 1st task and 
then set_fact, further use it in the shell command. I don't want to block 
the customer from using any special character. 

On Wednesday, August 22, 2018 at 7:35:23 PM UTC+5:30, Jean-Yves LENHOF 
wrote:
>
> Le 2018-08-22 14:00, Veena a écrit : 
> > Hi, 
> > 
> > I'm using Ansible 2.5 and trying to escape single quote in a string. 
> > This string will be passed as argument to shell command. 
> > 
> > regex_replace("'", "\'") is giving error. 
> > 
> >     - set_fact: 
> > 
> >        default_passphrase: "{{ Secrete123'!#) | regex_replace('"'"', 
> > '"\'"') }}" 
> > 
> > Please suggest how to achieve this. 
> > 
> > Thanks, 
> > -Veena 
> > 
>
>
> What do you want to do ? 
> Perhaps set a specific default password 
>
> Did you try this ? 
>
>     - set_fact: 
>         default_passphrase: "Secrete123\\'!#)" 
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/61fcc942-47ba-4ded-a13e-d36a9e2115b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to