Hug advise

How would you ask your ex for a hug? I’m so nervous he might say no. I don’t want to just go up and hug him. We just started talking as friends again a few days ago after 3 years of being broken up.