Question: I need build port with something as in shell:

> 
> cd /usr/ports/www/nginx/ && make HTTP\_GEOIP=YES BATCH=yes
> 
> 
> 

I can find [any](http://docs.ansible.com/ansible/portinstall_module.html) document, how run this with [ansible module portinstall](https://github.com/ansible/ansible-modules-extras/blob/devel/packaging/os/portinstall.py) =(

Answer: 
I'd like to add. Unfortunately, the proposed workaround is not idempotent.

`- name: Build Nginx with geoip.
 command: make HTTP_GEOIP=YES BATCH=yes
 args:
 chdir: /usr/ports/www/nginx/`
This means, that it will be always reported as "changed".
Seems like this operation is not implemented in the [port\_install module](http://docs.ansible.com/ansible/portinstall_module.html) The module is part of the [ansible-module-extra repository](http://docs.ansible.com/ansible/modules_extra.html) which means:

> 
> These modules are currently shipped with Ansible, but might be shipped separately in the future. They are also mostly maintained by the community. Non-core modules are still fully usable, but may receive slightly lower response rates for issues and pull requests.
> 
> 
> 

As BSD is (sadly) not very popular, chances that someone will implement the functionality is not very high.

But it is possible to work around these limitations by using the `command` module like this:

```
- name: Build Nginx with geoip.
  command: make HTTP_GEOIP=YES BATCH=yes
  args:
    chdir: /usr/ports/www/nginx/

```

I would recommend to write another task to check the state / version of the port installed on the system and add a `when` clause to the task otherwise Ansible would rebuild the port on every run.