Dashboard lights won' t work

I have a Ford F-150. For about a year and a half, the dashboard lights will sometimes not come on. The air will blow, but not cool. I can hit on the left side of the dashboard and all will work just fine.

Hitting something is a clue.
Now try wiggling the ignition key while it’s running with this malfunction.
Don’t turn it off just wiggle it.
A bad or worn out ignition switch will act this way. Not the ignition lock cylinder but the electrical switch down in the column. ( you never said what year it is. ) Many circuits run to and through the ignition switch. As you turn the key to start the truck, every circuit except the starter is momentarily deactivated untill you release the key when it’s started. At that time all those other circuits reconnect…unless it’s worn out inside the contacts of the ignition switch. My 1980 Bronco did this and there’s been others in the shop with this repair.

Another contact area could also be at fault. As age effects corrosion on electrical contacts, you may find the need to clean and reconnect many. Where harnesses plug to each other and to components ( like the instrument cluster and fuse box ) can be suspect. Find all that you can. Unplug then replug is the first step and often is enough. Unplug , clean , then plug back in is the next step all the while making sure that each wire in each gang plug is in all the way and tight.

Try hitting the steering column and see if that also works. On a 2003 ford truck at work the right turn signal does not work if the steering wheel is tilted all the way down.

What year is it and engine size?