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 propose to keep local file of customized build options and copy it to the host before portinstall.

```
- name: Copy customized build options
  copy: src="{{role_path}}/files/nginx-build-options"
        dest="/var/db/ports/www_nginx/options"

- name: Install nginx from the port
  portinstall: name=nginx state=present

```
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.