Erbil, Iraq (CNN) On a dusty plain to the east of Mosul, cranes are lowering concrete walls into place as prefabricated living quarters are trucked in.

It's a race against time: this will be an improvised base for troops from Iraq's 9th Armored Division amid final preparations for the assault to end ISIS' control of Iraq's second largest city and the group's last major stronghold in the country.

Iraqi troops were last in this part of northern Iraq in summer 2014, when they were fleeing the rampant advance of ISIS fighters.

Now, as part of an agreement with the Kurdistan Regional Government and the United States, they are preparing to reverse that humiliating loss.

"Today, you are closer than any time in the past to get rid of Daesh's injustice and tyranny," Iraqi Prime Minister Haider al Abadi told the people of Mosul on Tuesday, in the first live official telecast of state media to Mosul from Baghdad.

Some 4,000 troops of the Iraqi Security Forces are expected to arrive in this sector within days. Among the advance party of some 160 soldiers, relations with local Kurdish Peshmerga officers appear cordial and the mood relaxed.

There are regular meetings between the two sides and a Joint Operations Room has been set up. The Kurds -- who have played a key role in the fightback against ISIS -- say their role will be to support the ISF when the offensive gets underway, but they won't enter Mosul itself, a largely Sunni-Arab city.

At newly established front lines, bulldozers carve deep trenches out of the flinty soil to deter the most feared of ISIS' weapons: large suicide truck bombs. The villages immediately behind the front lines, occupied by ISIS until recent months, are still empty, some of their buildings obliterated by airstrikes.

Moats filled with oil

When asked when the attack will begin, Iraqi and Peshmerga officers have the same one-word answer: "Soon." It's widely thought that the multipronged offensive will begin in the second half of this month. In the meantime, there's been an uptick in coalition airstrikes -- mainly by US, French and British aircraft -- in and around Mosul.

By day there is scant evidence of movement or an ISIS presence among the ruined villages they still control to the east of Mosul. But Kurdish fighters say the enemy uses the cover of night to approach their positions with mortars and snipers.

Everyone expects a tough battle ahead. In the two years it has held Mosul, ISIS has built an elaborate network of defenses, including moats filled with oil that stretch around the outskirts of the city, ready to be set ablaze to obscure the vision of coalition air power.

US military officials estimate there are 3,500-5,000 ISIS fighters, a mixture of Iraqis and foreign fighters, in Mosul. ISIS supporters claim there are at least 7,000 fighters there.

Challenges ahead

But there are many other unknowns as the battle for Mosul looms:

How many ISIS fighters will stay to fight -- and how many will try to escape to fight another day? If not captured or killed, they could splinter into terror cells across a wide swath of Iraq.

How much support does ISIS retain in the city, if any, and where is it concentrated?

How many among the approximately 1 million civilians still thought to be trapped in the city will try to leave, and how many will hunker down?

And will there be an uprising against the ISIS presence among the city's people as the offensive nears the gates of Mosul? There has already been sporadic resistance, according to reports from inside Mosul.

JUST WATCHED Mosul's secret resistance against ISIS Replay More Videos ... MUST WATCH Mosul's secret resistance against ISIS 02:39

Some Peshmerga commanders expect it will take at least three months to clear the city as ISIS leaves sleeper cells behind. Others expect a quicker victory, with ISIS leaders choosing to retreat to the vast desert west of Mosul.

Untested alliance

There are also plenty of questions about the forces ranged against ISIS in Mosul. The offensive will be led by the Iraqi Security Forces. Some, such as the Golden Division, have had plenty of battle experience -- in Fallujah, Ramadi and elsewhere. But some contingents have only just finished training. Their relationship with the Peshmerga is untested.

Prime Minister al-Abadi and KRG President Masoud Barzani have agreed that only the ISF and Peshmerga will take part in the operation, but a variety of other militia also want to be involved.

They include Yazidi, Turkmen and Christian battalions trained and armed since the fall of Mosul, as well as a contingent of former Mosul military and police trained by Turkey and under the command of the city's former governor, Atheel al Nujaifi.

"We will raise the Iraqi flag in the center of the city of Mosul as we have raised it in Qayyara and Shirqat, and before it in Baiji, Tikrit, Ramadi, and Falluja and many other towns and villages that have been returned to the people of Iraq," al-Abadi said in his radio address.

The Turkish trainers -- and heavy artillery -- remain on Mount Bashiqa some 15 kilometers (9 miles) northeast of Mosul. CNN has witnessed Turkish guns opening up against ISIS positions on the plains below.

The Iraqi government has told Turkey its presence is unwelcome, but President Recep Tayyip Erdogan told the Turkish parliament on Saturday: "We will play a role in the Mosul liberation operation and no-one can prevent us from participating."

But the powerful Shia militia, known as the Hashd al Shabi, is not expected to have a direct role in the offensive to take Mosul, an overwhelmingly Sunni city. Human rights groups have accused the Hashd of widespread abuses during assaults on other largely Sunni areas.

Civilian exodus?

The longer the offensive continues and the worse the destruction gets, the more likely that a tide of civilians will try to escape.

The UN refugee agency's Iraq representative, Bruno Geddo, said last week that the exodus from Mosul could be "one of the largest man-made displacement crises of recent times." They will need transport and basic necessities; and the Peshmerga and ISF will need to screen those leaving.

JUST WATCHED Risking death to flee from ISIS Replay More Videos ... MUST WATCH Risking death to flee from ISIS 02:41

There is anxiety about suicide bombers -- especially teenage boys -- infiltrating the outflow. The ISF has already stated it won't allow civilians to leave in cars for fear of vehicle bombs.

Frantic preparations are being made to prepare camps for as many as 700,000 people leaving Mosul -- but aid agencies can only guess how many will flee and in which directions.

The 11 camps completed or planned will only accommodate 120,000 people, according to the UNHCR. Geddo says that only a third of the $196 million budget required has been funded.

Relief agencies are also dealing with people displaced by recent fighting south of Mosul, and expect as many as 100,000 to flee their homes as Iraqi and Kurdish forces close in on another ISIS pocket around the town of Hawija. There are already 3.3 million internally displaced people in Iraq.

There's also great concern among diplomats and Kurdish officials about plans for securing, stabilizing and governing Mosul once ISIS is evicted. US Deputy Secretary of State Antony Blinken told a Senate committee last week that some 15,000 Sunni tribal elements are being trained and equipped to be the holding force once Mosul is liberated. "We're well on track" to meet that goal, he said.

JUST WATCHED Iraqi PM: We're preparing for months-long fight in Mosul Replay More Videos ... MUST WATCH Iraqi PM: We're preparing for months-long fight in Mosul 09:02

In the longer run, integrating the various militia that have sprouted since Mosul fell to ISIS, devising better governance for the city, and making it liveable again, are challenges as great as liberating it in the first place.

US and Iraqi officials have spoken of creating eight self-governing areas in and around Mosul. Ever since Iraq's new constitution was passed, there's been much talk of local autonomy, but it's rarely been delivered. To many observers, Mosul will be the acid test of Iraq's viability -- and whether its complex mosaic of sectarian, tribal and ethnic groups can live in peace, if not harmony.