Change iTerm2 profile depending on current directory
Finally I found a solution using bash-preexec.

That utility have the following function:

precmd Executed just before each prompt. Equivalent to PROMPT_COMMAND, but more flexible and resilient.

To install bash-preexec: 

brew install bash-preexec


Then I have to add the following to my .bash_profile:

if [ -f $(brew --prefix)/etc/profile.d/bash-preexec.sh ]; then
    . $(brew --prefix)/etc/profile.d/bash-preexec.sh
    precmd() {
        if [[ $PWD == /mi/prod/path/produccion* ]]; then
            if [ -z $shouldChangeProfile ]; then
                echo -e "\033]50;SetProfile=production\a"
            fi
            shouldChangeProfile=1
        elif [ "$shouldChangeProfile" == "1" ]; then
            echo -e "\033]50;SetProfile=bash\a"
            unset shouldChangeProfile
        fi
    }
fi


Inside the precmd function is where I change the profile according to my needs. 

shouldChangeProfile prevents unnecessary profile changes.