Ivory Coast will start their defence of the Africa Cup of Nations against Togo in January, according to the draw made Wednesday.
Ivory Coast, who beat Ghana on penalties in the 2015 final, are in Group C against Togo, Morocco and the Democratic Republic of Congo.
Hosts Gabon, who saw political turmoil after a disputed election in August, will stage the opening match in Libreville on January 14 against Guinea-Bissau, who make their first appearance in the 16-nation tournament.
Cameroon and Burkina Faso are also in Group A.
The other group favourites, Algeria and Ghana, start against Zimbabwe and Uganda respectively.
Algeria have the toughest first round in Group B where they also take on Tunisia and Senegal for one of the two qualifying places for the quarter-finals.
Ghana are the team to beat in Group D. Apart from Uganda, they will take on Egypt, making their return to the contest after missing three finals, and Mali.
The final is in Libreville on February 5.
The draw produced three groups containing three of the top 10 ranked football nations in Africa, according to FIFA.
Algeria (2), Senegal (3) and Tunisia (4) are in one mini-league, Ivory Coast (1), DR Congo (6) and Morocco (10) in another and Ghana (5), Egypt (7) and Mali (9) in a third.
A lot of teams will get to know each other extremely well, too, as Ivory Coast and Morocco also share a 2018 World Cup qualifying group, as do Ghana, Egypt and Uganda.
Ivory Coast were not impressive in qualifying, drawing three of four matches against Sierra Leone and Sudan, and Morocco are probably a team they wanted to dodge.
The Moroccans are coached by Herve Renard, the charismatic Frenchman who masterminded the Ivorians' triumph in Equatorial Guinea last year.
He then left for a brief, unsuccessful spell in the French Ligue 1 before being hired by Morocco, and they became the first qualifiers for the 2017 tournament.
Renard has won the Cup of Nations twice, taking no-hopers Zambia to the title in Gabon four years ago.
"If I had to name teams I wanted to avoid before the draw, I would have said some of the teams in our group," admitted Renard.
"To face Ivory Coast is difficult, especially as we have had the chance to know their players, it's practically the same squad.
"But we have to be competitive. The match against Claude Le Roy (coach of Togo) will be something that again will be difficult for me.
"But over 90 minutes I have to forget everything this man did for me and do everything in order to beat him."
Veteran Le Roy has won the Cup of Nations once, with Cameroon in 1988, and Gabon will mark his ninth appearance at the Cup of Nations finals.
He has failed to reach the knockout stage only once.
Being grouped with Ghana offers Egypt yet another chance to avenge one of their most humiliating results, a 6-1 thrashing by the Black Stars in a 2014 World Cup qualifier.
No team will be more excited about going to Gabon in January than Uganda -- the last time they qualified was in 1978 when the notorious Idi Amin ruled the east African state.
Uganda coach Milutin 'Micho' Sredojevic said: ?This is a tough and competitive group, but I believe in the players and the team.
"We have a realistic chance to get good results and reach the knockout stage."
Although Gabon are the second lowest ranked team among the 16 contenders, they look set to make the last eight, probably with four-time champions Cameroon.
The hosts rely heavily on 2015 African Footballer of the Year Pierre-Emerick Aubameyang, a prolific goalscorer with German giants Borussia Dortmund.
During the draw ceremony, Gabonese officials emphasised that the country was ready to host a tournament they co-staged with neighbours Equatorial Guinea in 2012.
A disputed presidential election victory by incumbent Ali Bongo two months ago triggered riots with opposition parties claiming vote fraud.
New prime minister Emmanuel Issoze-Ngondet said: "We will not back away from the tournament. We are ready and will organise an exceptional tournament."