On Sun, 18 Aug 2024 09:45:11 -0400
Michael Starling <[email protected]> wrote:

> ldapservers:
>     - server1
>     - server2
>
> I would like the resulting file to look like this:
> 
> URI ldap://server1/ ldap://server2/

Put the below declarations as appropriate

    ldapservers: [server1, server2]
    uri: "{{ ['ldap://'] |
             product(ldapservers) | map('join') |
             product(['/'])| map('join') |
             join(' ') }}"

Then, the template is trivial

    - copy:
        content: |
          URI {{ uri }}
        dest: /tmp/uri.test

gives what you want

shell> cat /tmp/uri.test 
URI ldap://server1/ ldap://server2/

HTH,

-- 
Vladimir Botka

-- 
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/20240818175809.65c373f3%40gmail.com.

Attachment: pgphYeKEAgDzW.pgp
Description: OpenPGP digital signature

Reply via email to