# Better way to specify path to binary?

**URL:** <https://forum.ansible.com/t/better-way-to-specify-path-to-binary/19181>\
**Category:** Ansible Project\
**Created:** [September 3, 2015, 8:59pm UTC](https://forum.ansible.com/t/better-way-to-specify-path-to-binary/19181 "2015-09-03T20:59:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Lucas](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@James\_Lucas](https://forum.ansible.com/u/James_Lucas)\
**Post date:** [September 3, 2015, 8:59pm UTC](https://forum.ansible.com/t/better-way-to-specify-path-to-binary/19181/1 "2015-09-03T20:59:13Z")

</div>

Hello: I’ve been using the ‘pkgutil’ extras module to install packages on some Solaris machines. Roles

I’ve been working with that use the module will fail if ‘/opt/csw/bin’ is not in the servers’ PATH environment variable.  
It’s easy enough to work around by doing something like this in roles that depend on it:

- name: Install Nagios NRPE Server [Solaris]  
pkgutil: name=CSWnrpe state=present  
environment:  
PATH: “{{ansible\_env.PATH}}:/opt/csw/bin”

My question, though, is whether it would make sense to also supply a full path as a default in the module itself –

something like:

if not distutils.spawn.find\_executable(cmd):  
cmd = ‘/opt/csw/bin/pkgutil’

A quick look around similar modules suggest that it’s normal to supply a full path to the binary… for instance, in  
the ‘yum’ module:

yumbin=‘/usr/bin/yum’

Given that ‘pkgutil’ is by default installed into a location (‘/opt/csw/bin’) that is not  
in the system’s default PATH, wouldn’t it make sense to have the module either:

a) supply a default, rather than just assuming it’s available through the PATH?

or:

b) Just specify a full path to begin with, as in the ‘yum’ example above?

I myself prefer (a). I’d gladly submit a pull request for this if it seems like a good idea.

Thanks,  
James
