# Global arguments support (or command aliasing?)

**URL:** <https://forum.ansible.com/t/global-arguments-support-or-command-aliasing/12264>\
**Category:** Ansible Project\
**Created:** [January 30, 2013, 2:32pm UTC](https://forum.ansible.com/t/global-arguments-support-or-command-aliasing/12264 "2013-01-30T14:32:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oren\_Shomron](https://avatars.discourse-cdn.com/v4/letter/o/df705f/32.png) [@Oren\_Shomron](https://forum.ansible.com/u/Oren_Shomron)\
**Post date:** [January 30, 2013, 2:32pm UTC](https://forum.ansible.com/t/global-arguments-support-or-command-aliasing/12264/1 "2013-01-30T14:32:49Z")

</div>

Hi everyone,

I am trying to find the best way of supporting HTTP proxies with the pip command.  
pip accepts the proxy as a --proxy argument, which can be supplied with the new “extra\_args” parameter on the dev branch.

But - how do I set this parameter globally without restating it for each and every pip command in my play?  
Would it make sense to alias a command and supply global arguments there?  
Is there a way to seed a module with defaults for the duration of a play?  
Some other way?

Thanks,

- Oren

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [January 31, 2013, 3:19pm UTC](https://forum.ansible.com/t/global-arguments-support-or-command-aliasing/12264/2 "2013-01-31T15:19:32Z")

</div>

I have a patch that adds configurable defaults to template (jinja2 defaults) it should not be hard to do the same for other modules.

---

<div class="post-metadata">

**Author:** ![Daniel\_Hokka\_Zakriss](https://avatars.discourse-cdn.com/v4/letter/d/f05b48/32.png) [@Daniel\_Hokka\_Zakriss](https://forum.ansible.com/u/Daniel_Hokka_Zakriss)\
**Post date:** [January 31, 2013, 3:28pm UTC](https://forum.ansible.com/t/global-arguments-support-or-command-aliasing/12264/3 "2013-01-31T15:28:07Z")

</div>

Oren Shomron wrote:

> Hi everyone,
> 
> I am trying to find the best way of supporting HTTP proxies with the pip  
> command.  
> pip accepts the proxy as a --proxy argument, which can be supplied with  
> the  
> new "extra\_args" parameter on the dev branch.
> 
> But - how do I set this parameter globally without restating it for each  
> and every pip command in my play?  
> Would it make sense to alias a command and supply global arguments there?  
> Is there a way to seed a module with defaults for the duration of a play?  
> Some other way?

Easiest way? Use action: $pip and set pip to "pip yourargs" in your vars:  
section.

Daniel

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [January 31, 2013, 3:43pm UTC](https://forum.ansible.com/t/global-arguments-support-or-command-aliasing/12264/4 "2013-01-31T15:43:37Z")

</div>

There's more to it than this, folks.

We actually have the proxy problem some at work.

pip didn't, at least at one point, support getting environment  
variables from http\_proxy. You have to specify it to the pip binary.

So while Daniel's shortcut will prevent needing to supply that to the  
play more than once, it is also true that we need to modify the pip  
module to support a proxy.

It is ALSO true that it is useful to set proxies for lots of other  
commands, where I was suggesting we have some capability like:

- action: arbitrary  
&nbsp;&nbsp;env: $my\_env

where even is a hash like:

vars:  
&nbsp;&nbsp;&nbsp;my\_env:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http\_proxy: [http://blarg:8080](http://blarg:8080)

And that way, for any arbitrary command, we can easily add OS  
enviornment variables on the front. This is something I'm going to  
do if no one beats me to it first.

But it, at least to my knowledge, won't help pip unless it finally  
respects those HTTP\_PROXY setttings. Note, I'm just going off what I  
heard from someone else about pip, have not actually attempted that  
part yet.
