# Global environment variables

**URL:** <https://forum.ansible.com/t/global-environment-variables/24601>\
**Category:** Ansible Project\
**Created:** [May 30, 2017, 6:25pm UTC](https://forum.ansible.com/t/global-environment-variables/24601 "2017-05-30T18:25:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![goreilly](https://avatars.discourse-cdn.com/v4/letter/g/ecd19e/32.png) [@goreilly](https://forum.ansible.com/u/goreilly)\
**Post date:** [May 30, 2017, 6:25pm UTC](https://forum.ansible.com/t/global-environment-variables/24601/1 "2017-05-30T18:25:23Z")

</div>

I have installed some software into /usr/local/bin on a server. I want to reference use them without passing _environment_ to every task or playbook.

`

```auto
- command: foo
  environment:

```

PATH: ‘/usr/local/bin:{{ ansible\_env.PATH }}’

`

I have tried updating /etc/profile, /etc/environment, but Ansible does not load them. It only displays this when I dump echo $PATH.

`

ok: [[fizz.buzz.com](http://fizz.buzz.com)] =\> {

“changed”: false,

“test”: {

“changed”: true,

“cmd”: “echo $PATH”,

“delta”: “0:00:00.002801”,

“end”: “2017-05-30 13:04:44.151947”,

“rc”: 0,

“start”: “2017-05-30 13:04:44.149146”,

“stderr”: “”,

“stderr\_lines”: ,

“stdout”: “/sbin:/bin:/usr/sbin:/usr/bin”,

“stdout\_lines”: [

“/sbin:/bin:/usr/sbin:/usr/bin”

]

}

}

`

Is there any way I can make it load them automatically? I don’t really want to install into /bin because of the possibility of package managers overwriting software.

Thanks

---

<div class="post-metadata">

**Author:** ![Daniel\_JD](https://avatars.discourse-cdn.com/v4/letter/d/f19dbf/32.png) [@Daniel\_JD](https://forum.ansible.com/u/Daniel_JD)\
**Post date:** [June 1, 2017, 10:53am UTC](https://forum.ansible.com/t/global-environment-variables/24601/2 "2017-06-01T10:53:05Z")

</div>

Use the shell module instead of the command module. This will give you a valid shell environment (incl. /etc/profile, /etc/environment etc.)
