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

```