[ansible-project] Re: Nested variables and Regex...
Thanks for helping me out. :) Sadly it looks like that the construct itself is the issue and not the regex. After I resolved the "recursive loop detected in template" issue, I ran into another one. I have to dig into that one first to resolve this entirely. Nevertheless thanks for your help. :) -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6e0ebb7c-c33b-4c6a-be21-871c662c8cee%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Re: Nested variables and Regex...
Here you go: elasticsearchclustername: "es{{ (server_hostname + software_version) | regex_replace('[ .,;-]+', '') }}" Am Freitag, 7. Juli 2017 12:01:12 UTC+2 schrieb re...@charbonneau.de: > > Dear community, > > sorry that I have to bother you but I don't get it. > > My goal is to create a nested variables which consists of a static text > and two other variables. The thing is, the two variables may contain > characters that should be "removed". > > This is my (java) regex: [\s\,\.\;\-\_]+ > > And I wanted to do something like that: > > elasticsearchclustername: "es{{ server_hostname | > regex_replace('([\\s\\,\\.\\;\\-\\_]+)') }}{{ software_version | > regex_replace('([\\s\\,\\.\\;\\-\\_]+)') }}" > > After that I use the new variable (elasticsearchclustername) within > different jinja2 templates. But that is when I get an "recursive loop > detected in template" error. > > I really hate regex and I would appreciate any input. > > Thanks in advance. > > René > -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/dabe4f35-bf28-407c-8b2c-1e4658175306%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Re: Nested variables and Regex...
Change it to regex_replace(r'[\s,\.;-_]+') You can test what it does on debuggex.com Am Freitag, 7. Juli 2017 12:01:12 UTC+2 schrieb re...@charbonneau.de: > > Dear community, > > sorry that I have to bother you but I don't get it. > > My goal is to create a nested variables which consists of a static text > and two other variables. The thing is, the two variables may contain > characters that should be "removed". > > This is my (java) regex: [\s\,\.\;\-\_]+ > > And I wanted to do something like that: > > elasticsearchclustername: "es{{ server_hostname | > regex_replace('([\\s\\,\\.\\;\\-\\_]+)') }}{{ software_version | > regex_replace('([\\s\\,\\.\\;\\-\\_]+)') }}" > > After that I use the new variable (elasticsearchclustername) within > different jinja2 templates. But that is when I get an "recursive loop > detected in template" error. > > I really hate regex and I would appreciate any input. > > Thanks in advance. > > René > -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/aa00e26d-6fc9-49b6-b1e2-da7f61f82f07%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.