# Read a text file over https address into variable

**URL:** <https://forum.ansible.com/t/read-a-text-file-over-https-address-into-variable/25024>\
**Category:** Ansible Project\
**Tags:** kubernetes\
**Created:** [July 19, 2017, 11:05pm UTC](https://forum.ansible.com/t/read-a-text-file-over-https-address-into-variable/25024 "2017-07-19T23:05:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Homayoun\_Najafizadeh](https://avatars.discourse-cdn.com/v4/letter/h/f1d935/32.png) [@Homayoun\_Najafizadeh](https://forum.ansible.com/u/Homayoun_Najafizadeh)\
**Post date:** [July 19, 2017, 11:05pm UTC](https://forum.ansible.com/t/read-a-text-file-over-https-address-into-variable/25024/1 "2017-07-19T23:05:41Z")

</div>

Hi All,

Is there anyway I can download this path via Ansible?

curl -LO [https://storage.googleapis.com/kubernetes-release/release/$](https://storage.googleapis.com/kubernetes-release/release/$)(curl -s [https://storage.googleapis.com/kubernetes-release/release/stable.txt](https://storage.googleapis.com/kubernetes-release/release/stable.txt))/bin/linux/amd64/kubectl

As you can see the path is variable based on value in stable.txt file (at this point is ‘1.7.1’).

Thanks

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [July 20, 2017, 5:57am UTC](https://forum.ansible.com/t/read-a-text-file-over-https-address-into-variable/25024/2 "2017-07-20T05:57:38Z")

</div>

- name: Test playbook  
&nbsp;&nbsp;hosts: localhost  
&nbsp;&nbsp;gather\_facts: false  
&nbsp;&nbsp;become: false

&nbsp;&nbsp;tasks:  
&nbsp;&nbsp;- uri:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url: [https://storage.googleapis.com/kubernetes-release/release/stable.txt](https://storage.googleapis.com/kubernetes-release/release/stable.txt)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return\_content: yes  
&nbsp;&nbsp;&nbsp;&nbsp;register: response

&nbsp;&nbsp;- set\_fact:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;version: "{{ response.content | trim }}"

&nbsp;&nbsp;- debug: var=version

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 20, 2017, 2:22pm UTC](https://forum.ansible.com/t/read-a-text-file-over-https-address-into-variable/25024/3 "2017-07-20T14:22:00Z")

</div>

Or if you don't need any of the 'advanced' features of the uri module"

- set\_fact:  
&nbsp;&nbsp;&nbsp;&nbsp;version:"'{{lookup('url',  
'[https://storage.googleapis.com/kubernetes-release/release/stable.txt](https://storage.googleapis.com/kubernetes-release/release/stable.txt),  
split\_lilnes=False')}}"
