On 07.02.17 17:07 fanvalt wrote:
> Thanks a lot Marko, I used your syntax:
> dual|regex_replace('^SRV(.*)', 'True')
Did you try the following?
> No need to use regex for pattern searching. You can use search like
> this:
>
> when: name_prefix | search("stage-dbs")
from
thank you I will have a look at your solution, I finally found this way to
proceed otherwise:
- set_fact:
services: "{{ services }} + SRV{{item }}"
with_sequence: count=5
- set_fact:
distrib: "{{ distribsrv }}"
when: dual in services
TASK [debug]
I know this is weird, but can't think of something better:
- set_fact:
distrib: "{{ distribsrv }}"
Directoryname: "{{ Directorysrv }}"
when: dual | regex_replace( '^SRV.*', 'True') | bool
Cheers,
Marko
CONFIDENTIALITY NOTICE: This message is the property of International Game
My issue is: I would like to run a task when a variable start with 'SRV'
(srv1, SRV2 ...) ad I don't know how to write the condition: when: dual
like 'SRV*'
Le mardi 7 février 2017 14:45:44 UTC+1, fanvalt a écrit :
>
> Hello,
>
> Actually I wrote my playbook this way to set values id the dual
if I write this, i do not get a variable list:
- set_fact:
services: "{{ services + item }}"
with_sequence: count=99
- debug: msg="sequence {{ services }}"
ok: [SRV1] => {
"msg": "sequence
I wrote this:
vars:
services:
- SRV
- SRV[1:99]
- set_fact:
distrib: "{{ distribsrv }}"
when: dual in services
but dual is SRV2 and the set_fact module has been ignored
Le mardi 7 février 2017 14:45:44 UTC+1, fanvalt a écrit :
>
> Hello,
>
> Actually I wrote my