The Book of Joshua describes little more than a genocidal campaign against the unsuspecting inhabitants of Canaan. The Canaanites never attacked the Israelites, never enslaved the Israelites, and aren't described as ever having done anything to warrant mistreatment of any sort. Their only crime was living in the wrong place at the wrong time — land promised to the Israelites by God at the time when God decided to make good on that promise.
Commanded to Commit Genocide
It's impossible to know the moral or mental disposition of the Israelites and in fact the text doesn't really delve into their psychology at all; the length and breadth of their roles consists of obeying or disobeying Yahweh. It is thus to Yahweh that we turn to understand the genocidal actions of the Israelites. Through much of the relevant text only Yahweh is presented as being truly active and, as one might expect, all of the impetus for genocide indeed comes from Yahweh.
And when the Lord thy God shall deliver them before thee; thou shalt smite them, and utterly destroy them; thou shalt make no covenant with them, nor shew mercy unto them: Neither shalt thou make marriages with them; thy daughter thou shalt not give unto his son, nor his daughter shalt thou take unto thy son.
Similar instructions appear in subsequent texts and they are clear that not only are the Israelites to make total war on the inhabitants, but they are also prohibited from entering into any sort of peace treaty with any group. There is to be no mercy for anyone, only death.
The Israelites got some practice in this by making war against the Midianites:
And they warred against the Midianites, as the Lord commanded Moses; and they slew all the males. ...And the children of Israel took all the women of Midian captives, and their little ones, and took the spoil of all their cattle, and all their flocks, and all their goods. ...
And Moses said unto them...Now therefore kill every male among the little ones, and kill every woman that hath known man by lying with him. But all the women children, that have not known a man by lying with him, keep alive for yourselves.
So were the young virgin girls lucky that they weren't slaughtered like the rest of their people, or were they unlucky that they were essentially taken as sex slaves to be used to satiate the lusts of the soldiers who slaughtered their fathers, mothers, brothers, and older sisters?
The Book of Joshua makes it clear that the Israelites get to the murderous work of genocide and become quite efficient at it:
And all the cities of those kings, and all the kings of them, did Joshua take, and smote them with the edge of the sword, and he utterly destroyed them, as Moses the servant of the Lord commanded. ...every man they smote with the edge of the sword, until they had destroyed them, neither left they any to breathe. As the Lord commanded Moses his servant, so did Moses command Joshua, and so did Joshua; he left nothing undone of all that the Lord commanded Moses.
Raphael Lemkin argues in Axis Rule in Occupied Europe that one of the distinguishing features of genocide is not simply mass killing, which happens frequently in war, but the goal-oriented mass killing that is designed to destroy or culture or society with the purpose of replacing it entirely. This is definitely what we see happening in Joshua: the Israelites kill all the people in order to destroy their culture then move in to take over their fields, vineyards, cities, and lands.
Bullied and Threatened into Genocide
To be fair to the Israelites, it should be noted that they may have been operating from more than a little fear. Given their experience of what Yahweh did to their enemies, did they really want to become Yahweh's enemies too? Probably not — and Yahweh certainly made threats about what would happen if they Israelites didn't do as they were told:
But if ye will not drive out the inhabitants of the land from before you; then it shall come to pass, that those which ye let remain of them shall be pricks in your eyes, and thorns in your sides, and shall vex you in the land wherein ye dwell. Moreover it shall come to pass, that I shall do unto you, as I thought to do unto them. (Numbers 33:55-56)
This is of course not the only threat issued to the Israelites, but it is the one which most closely associates Yahweh's actions against the Canaanites with possible action against them: if they don't follow orders to commit genocide, Yahweh might decide to cause a bit of genocide against them instead.
This doesn't entirely let the Israelites of the hook for their actions, but insofar as their guilt is mitigated at all, it's magnified many times over for Yahweh. Not only did Yahweh order genocide to be committed and not only did he actively assist to ensure that genocide was committed, but he threatened his thugs that if they didn't blindly obey their murderous orders then he'd do the same to them later on.
And even that's not the worst...
Ensuring that Genocide Occurs
Committing genocide against the indigenous people of Canaan was made easier by the fact that they were willing to fight for their ancestral homes. It's easier to slaughter people who are trying to kill you, even if you're the one who started the fight. Had the Canaanites tried to welcome the newcomers and pursue peaceful treaties, genocide might have been harder. Even the most fanatical religious zealot has a harder time slaughtering unarmed, peaceful people.
Apparently Yahweh thought of this and took steps to ensure that nothing like this would interfere with his plans:
There was not a city that made peace with the children of Israel, save the Hivites the inhabitants of Gibeon: all other they took in battle. For it was of the Lord to harden their hearts, that they should come against Israel in battle, that he might destroy them utterly, and that they might have no favor, but that he might destroy them, as the Lord commanded Moses. (Joshua 11:19-20)
So Yahweh "hardened" the hearts of the Canaanites to guarantee that they would "come against Israel in battle." Had he not done that, some of the Canaanites might have chosen a more peaceful solution and the Israelites might have been tempted to befriend them. Instead, they slaughtered everyone.
Where else have we seen this? Not long before, Yahweh did the same thing with the pharaoh in Egypt: every time the pharaoh was about to let the Israelites god, Yahweh hardened his heart to ensure that he would say "no" and keep them a while longer as slaves. This guaranteed that Yahweh would get to kill all the firstborn sons of all the Egyptians as a show of psychopathic power.
This is thus a persistent pattern for Yahweh: order one group of humans to harm a second group of humans, then take away the free will of the second ground and force them to act in a way that ensures conflict can occur. This sounds remarkably like a child torturing small animals and we all know what happens to kids like that.