I have the following regex in my playbook:
   - name: get business ID
     set_fact:
       my_var: "{{ inventory_hostname | 
regex_findall('.+?(?=-).+?(?=-).+?(?=-).+?(?=-)+') }}"

the debug returns the right value:

ok: [DE-LEI-GRO-GROLE-F001-FW01-MDF] => {
    "my_var": [
        "DE-LEI-GRO-GROLE"

when using create directory
   - name: create directory
     file:
       path: /home/vinn/devicebackups/{{ my_var }}
       state: directory

its creates the directory adding [' ’]

"path": "/home/vinn/devicebackups/[''DE-LEI-GRO-GROLE’]",


any idea why??

thanks a lot

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2309056a-d855-4546-8c4e-3df7b6da36a2n%40googlegroups.com.

Reply via email to