# Ansible-galaxy with http/s proxy

**URL:** <https://forum.ansible.com/t/ansible-galaxy-with-http-s-proxy/19132>\
**Category:** Ansible Project\
**Tags:** galaxy-ng\
**Created:** [August 27, 2015, 9:37pm UTC](https://forum.ansible.com/t/ansible-galaxy-with-http-s-proxy/19132 "2015-08-27T21:37:41Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emilio\_Del\_Plato](https://avatars.discourse-cdn.com/v4/letter/e/df788c/32.png) [@Emilio\_Del\_Plato](https://forum.ansible.com/u/Emilio_Del_Plato)\
**Post date:** [August 27, 2015, 9:37pm UTC](https://forum.ansible.com/t/ansible-galaxy-with-http-s-proxy/19132/1 "2015-08-27T21:37:41Z")

</div>

Apologies if this has been covered somewhere and I missed it.

Is it possible to have ansible-galaxy (CLI) connect using a proxy? we have our primary ansible box walled off and it needs to use a proxy to connect to the web ([galaxy.ansible.com](http://galaxy.ansible.com), [github.com](http://github.com)…)  
I have tried using tsocks as well as setting environment variables but none of these options seem to be honored by galaxy cli.

Is anyone aware of anyother method to use ansible-galaxy with a proxy?

---

<div class="post-metadata">

**Author:** ![Greg\_DeKoenigsberg1](https://avatars.discourse-cdn.com/v4/letter/g/838e76/32.png) [@Greg\_DeKoenigsberg1](https://forum.ansible.com/u/Greg_DeKoenigsberg1)\
**Post date:** [August 28, 2015, 2:57pm UTC](https://forum.ansible.com/t/ansible-galaxy-with-http-s-proxy/19132/2 "2015-08-28T14:57:30Z")

</div>

A quote from someone smarter than me:

"It's using urllib/httplib so setting the http{s}\_proxy environment  
variable should have it use the proxy."

(Hint: the person is jimi-c.)

--g

---

<div class="post-metadata">

**Author:** ![Emilio\_Del\_Plato](https://avatars.discourse-cdn.com/v4/letter/e/df788c/32.png) [@Emilio\_Del\_Plato](https://forum.ansible.com/u/Emilio_Del_Plato)\
**Post date:** [August 28, 2015, 3:36pm UTC](https://forum.ansible.com/t/ansible-galaxy-with-http-s-proxy/19132/3 "2015-08-28T15:36:52Z")

</div>

when we tried that it did not appear to work. Ill give it another try.

Thanks for the reply.  
~Emilio

---

<div class="post-metadata">

**Author:** ![Greg\_DeKoenigsberg1](https://avatars.discourse-cdn.com/v4/letter/g/838e76/32.png) [@Greg\_DeKoenigsberg1](https://forum.ansible.com/u/Greg_DeKoenigsberg1)\
**Post date:** [August 28, 2015, 4:34pm UTC](https://forum.ansible.com/t/ansible-galaxy-with-http-s-proxy/19132/4 "2015-08-28T16:34:47Z")

</div>

If it fails for you again, give us some more specific info and we'll dig in.

--g

---

<div class="post-metadata">

**Author:** ![user66](https://avatars.discourse-cdn.com/v4/letter/u/b487fb/32.png) [@user66](https://forum.ansible.com/u/user66)\
**Post date:** [January 10, 2016, 7:15am UTC](https://forum.ansible.com/t/ansible-galaxy-with-http-s-proxy/19132/5 "2016-01-10T07:15:36Z")

</div>

I’ve got the same problem.  
I’ve set up cntlm. It listens

`

$ sudo netstat -nlp --inet | grep 3128  
tcp 0 0 127.0.0.1:3128 0.0.0.0:\* LISTEN 13673/cntlm

`

I’ve got a bash script that suppose to install all my roles:

`

#!/bin/bash

https\_proxy=“[http://127.0.0.1:3128](http://127.0.0.1:3128)”  
http\_proxy=“[http://127.0.0.1:3128](http://127.0.0.1:3128)”

cat Ansiblefile\_external\_roles.yml \> Ansiblefile.yml  
ansible-galaxy install -r Ansiblefile.yml

`

but if fails:

`

bash -x ansible\_install\_roles.sh

- https\_proxy=[http://127.0.0.1:3128](http://127.0.0.1:3128)
- http\_proxy=[http://127.0.0.1:3128](http://127.0.0.1:3128)
- cat Ansiblefile\_external\_roles.yml
- ansible-galaxy install -r Ansiblefile.yml --force

- the API server ([galaxy.ansible.com](http://galaxy.ansible.com)) is not responding, please try again later.

`

---

<div class="post-metadata">

**Author:** ![user66](https://avatars.discourse-cdn.com/v4/letter/u/b487fb/32.png) [@user66](https://forum.ansible.com/u/user66)\
**Post date:** [January 10, 2016, 7:34am UTC](https://forum.ansible.com/t/ansible-galaxy-with-http-s-proxy/19132/6 "2016-01-10T07:34:00Z")

</div>

forgot to mention!

`  
ansible-1.9.4-1.fc23.noarch

`

`

cat Ansiblefile.yml

- src: jtyr.environment  
path: roles

`

if Ansiblefile.yml contains

`

- src: [https://github.com/picotrading/ansible-sudo.git](https://github.com/picotrading/ansible-sudo.git)  
name: jtyr.sudo  
path: roles

`

script succeeds

---

<div class="post-metadata">

**Author:** ![Jameson](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jameson](https://forum.ansible.com/u/Jameson)\
**Post date:** [January 11, 2016, 3:57pm UTC](https://forum.ansible.com/t/ansible-galaxy-with-http-s-proxy/19132/7 "2016-01-11T15:57:34Z")

</div>

I’m also running into this issue. I have http\_proxy and https\_proxy variables pointing to our proxy server, and I’m able to wget and curl from [galaxy.ansible.com](http://galaxy.ansible.com), but if I run ansible-galaxy init, I get “- the API server ([galaxy.ansible.com](http://galaxy.ansible.com)) is not responding, please try again later.” Is the only way I’ll be able to use it at this point manually downloading? Thanks.

=-Jameson

---

<div class="post-metadata">

**Author:** ![Chris\_Houseknecht](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@Chris\_Houseknecht](https://forum.ansible.com/u/Chris_Houseknecht)\
**Post date:** [January 11, 2016, 9:40pm UTC](https://forum.ansible.com/t/ansible-galaxy-with-http-s-proxy/19132/8 "2016-01-11T21:40:02Z")

</div>

This works in ansible 2.0. It requires using the --ignore-certs flag.

I simulated a proxy server using Charles Proxy. In the Charles proxy settings I enabled SSL Proxying for [galaxy.ansible.com:443](http://galaxy.ansible.com:443). Then I did the following:

$ export https\_proxy=[http://localhost:8888](http://localhost:8888)

$ ansible-galaxy --ignore-certs init my-role-foo

- my-role-foo was created successfully

From the above I can see the request route through Charles and return a valid response from the API. Without --ignore-certs the init command fails. I think the issue is that the proxy is not forwarding the root certificate from [galaxy.ansible.com](http://galaxy.ansible.com) down to the client.

Prior to 2.0 the --ignore-certs flag is not available on the init command. I’m looking into the code now and will submit a PR to add it.

–Chris

---

<div class="post-metadata">

**Author:** ![Chris\_Houseknecht](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@Chris\_Houseknecht](https://forum.ansible.com/u/Chris_Houseknecht)\
**Post date:** [January 11, 2016, 11:27pm UTC](https://forum.ansible.com/t/ansible-galaxy-with-http-s-proxy/19132/9 "2016-01-11T23:27:03Z")

</div>

Submitted PR [https://github.com/ansible/ansible/pull/13808](https://github.com/ansible/ansible/pull/13808) to add --ignore-certs option to init, install and info commands in ansible-galaxy 1.9.4.

–Chris

---

<div class="post-metadata">

**Author:** ![Bill\_WANG](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@Bill\_WANG](https://forum.ansible.com/u/Bill_WANG)\
**Post date:** [January 19, 2016, 2:17am UTC](https://forum.ansible.com/t/ansible-galaxy-with-http-s-proxy/19132/10 "2016-01-19T02:17:00Z")

</div>

Thanks, the way to install via https works for me.

---

<div class="post-metadata">

**Author:** ![Andrew\_Cheruiyot](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@Andrew\_Cheruiyot](https://forum.ansible.com/u/Andrew_Cheruiyot)\
**Post date:** [July 16, 2019, 8:28am UTC](https://forum.ansible.com/t/ansible-galaxy-with-http-s-proxy/19132/11 "2019-07-16T08:28:55Z")

</div>

Thank you --ignore-certs worked for me.

Regards,  
Andrew
