The examples you and
@Minchandre give are what sociologists call
middleman minorities. Wikipedia's list there is good, though I have my quibbles (I certainly wouldn't call Azeri Turks in Safavid Iran "middleman minorities," they were more of a professional militarized ethnicity).
The Romani (Gypsies) and their analogues, like the
Nomads of India, are another type of specializing minorities called "peripatetic service nomads," nomadic populations that carry out minor services, most commonly tool repair and entertainment, that their host sedentary populations require. This is how "Tinker" became a word for Irish Travelers and Romani ("tinker" used to mean "tinsmith").
Some ethnicities exploit different ecological zones that their neighbors don't care for and thereby provide important services to the majority population. These include the Hakkas of southern China, the "Sea Gypsies" of Southeast Asia, and the forest peoples of Central Africa.
Some ethnicities enter special contracts with the state because of their (real or perceived) military qualities and serve as "martial races," like the Tatars mentioned by
@Augenis. The British Raj is famous for this, but most empires have employed some variety of this. The use of southwest hill tribes as scouts by the Ming empire, or the importance of northwestern Turks in the sixteenth-century Safavid empire, are examples of this.
In some places, minority ethnicities play important religious roles because their ethnic group is so closely associated with sacred authority. The best example I can think of is the role of Tibetans in Early Modern Mongolia, but Hadhrami Arabs played a similar role in eighteenth-century Indonesia.