get_url and regex_replace

Hi All

I’m trying to use the get_url module to download and rename at the same time. It does not work. Should it?

`

  • name: Download
    get_url:
    url: “{{ cfssl.download_url }}/{{ item }}”
    dest: “{{ cfssl.install_dir }}/{{ item | regex_replace(‘^(.)_(.)$’, ‘\1’) }}”
    mode: 0755
    with_items:

  • cfssl_linux-amd64

  • cfssljson_linux-amd64

  • name: print
    debug: msg=“{{ cfssl.install_dir }}/{{ item | regex_replace(‘^(.)_(.)$’, ‘\1’) }}”
    with_items:

  • cfssl_linux-amd64

  • cfssljson_linux-amd64

`

Thanks!

Ah, found it. Needed to double escape the underscore.

`

  • name: Download
    get_url:
    url: “{{ cfssl.download_url }}/{{ item }}”
    dest: “{{ cfssl.install_dir }}/{{ item | regex_replace(‘^(.)\_(.)$’, ‘\1’) }}”
    mode: 0755
    with_items:
  • cfssl_linux-amd64
  • cfssljson_linux-amd64

`

:slight_smile: