-1

When I set an env variable from an ansible playbook like this:

- name: Setting variable
  shell: echo $URL
  environment:
    URL: "{{ URL }}"

I would like this variable to be seen from the localhost but it's not the case:

echo $URL

gives nothing.

How can I make URL visible to the host OS ?

EDIT:

  • I used register but it's not working as I expected
  • I don't only want to verify if the variable is set, I want to use this environment variable from any other application in my host.
4m1nh4j1
  • 4,289
  • 16
  • 62
  • 104

1 Answers1

0

Crude workaround -

- name: Setting variable
  shell: |
    export URL={{ URL }}
    echo $URL

Yeah, I don't like it either, but if you're using shell, it should get you moving.

Paul Hodges
  • 13,382
  • 1
  • 17
  • 36