Was he the Secretary beforehand and was in on it from the start and helping them (Ethan and team) to pull out a bluff to go undercover?
Wikipedia makes this clear. The whole IMF (which seems to be a fairly large organisation) was disbanded and incorporated into the CIA.
CIA Director Alan Hunley and IMF Field Operations Director William Brandt testify before a Senate committee. The IMF, currently without a secretary in charge, is controversial because of its destructive methods and various misconducts. Hunley succeeds in having the IMF disbanded and absorbed into the CIA.
Hunley, having witnessed an IMF operation's success firsthand, returns with Brandt to the Senate committee meeting and convinces them to restore the IMF by covering for Hunt and his team. After the meeting, Brandt congratulates Hunley, who is now the new IMF Secretary.