As you do the same thing for ip v4 and v6:

        if [ "$role" == "CB" ] || [ "$role" == "CB_IPV6" ]
        then
        fi

However, is 'role' really the correct variable to hold that info?
Perhaps a new variable should be invented?

And for the option '-ipv6', a variable (normally empty) could be used:

        IPv6Ooption=""
        if [ ipv6 ]
        then
          IPv6Ooption="-ipv6"
        fi

contextBroker ... $IPv6Option

In the case of ipv4, the variable IPv6Option is the empty string