thanks, eventually after a few hours i came to a similar conclusion, i was
hoping there was a more elegant way which didn't need a series of finds

On Fri, Mar 22, 2024 at 4:01 PM Vladimir Botka <vbo...@gmail.com> wrote:

> On Fri, 22 Mar 2024 14:15:03 -0400
> Michael DiDomenico <mdidomeni...@gmail.com> wrote:
>
> > ... copy a bunch of ssl ca certs into a directory ...
> > create *.0 symlinks to each of the certs
>
> FWIW, instead of handlers, get the lists of the certs and
> links, and iterate the difference
>
>
>     - find:
>         paths: /tmp/ansible/certs
>         patterns: '*.crt'
>       register: out_crt
>
>     - find:
>         paths: /tmp/ansible/certs
>         patterns: '*.0'
>         file_type: link
>       register: out_lnk
>
>     - file:
>         state: link
>         src: /tmp/ansible/certs/{{ item }}.crt
>         dest: /tmp/ansible/certs/{{ item }}.0
>       loop: "{{ certs | difference(links) }}"
>       vars:
>         certs: "{{ out_crt.files |
>                    json_query('[].path') |
>                    map('basename') |
>                    map('splitext') |
>                    map('first') }}"
>         links: "{{ out_lnk.files |
>                    json_query('[].path') |
>                    map('basename') |
>                    map('splitext') |
>                    map('first') }}"
>
> Fit the paths to your needs.
>
> --
> 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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CABOsP2MKcFEkN58NT0TkgAzTgDywjO0vA8bSPpG3-47frPrwNA%40mail.gmail.com.

Reply via email to